interface ICoreWebView2ExperimentalWebResourceResponseView
Note
This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.
Note
This an experimental API that is shipped with our prerelease SDK. See WebView2 release notes.
interface ICoreWebView2ExperimentalWebResourceResponseView
: public IUnknown
View of the HTTP representation for a web resource response.
Summary
Members | Descriptions |
---|---|
get_Headers | The HTTP response headers as received. |
get_ReasonPhrase | The HTTP response reason phrase. |
get_StatusCode | The HTTP response status code. |
GetContent | Get the response content asynchronously. |
The properties of this object are not mutable. This response view is used with the WebResourceResponseReceived event.
Members
get_Headers
The HTTP response headers as received.
public HRESULT get_Headers(ICoreWebView2HttpResponseHeaders ** headers)
get_ReasonPhrase
The HTTP response reason phrase.
public HRESULT get_ReasonPhrase(LPWSTR * reasonPhrase)
get_StatusCode
The HTTP response status code.
public HRESULT get_StatusCode(int * statusCode)
GetContent
Get the response content asynchronously.
public HRESULT GetContent(ICoreWebView2ExperimentalWebResourceResponseViewGetContentCompletedHandler * handler)
The handler will receive the response content stream. If this method is being called again before a first call has completed, the handler will be invoked at the same time the handlers from prior calls are invoked. If this method is being called after a first call has completed, the handler will be invoked immediately.
webResourceResponse->GetContent(
Callback<
ICoreWebView2ExperimentalWebResourceResponseViewGetContentCompletedHandler>(
[this, webResourceRequest,
webResourceResponse](HRESULT result, IStream* content) {
std::wstring message =
L"{ \"kind\": \"event\", \"name\": "
L"\"WebResourceResponseReceived\", \"args\": {"
L"\"request\": " +
RequestToJsonString(webResourceRequest.get()) +
L", "
L"\"response\": " +
ResponseToJsonString(webResourceResponse.get(), content) +
L"}";
message +=
WebViewPropertiesToJsonString(m_webviewEventSource.get());
message += L"}";
PostEventMessage(message);
return S_OK;
})
.Get());
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for