interface ICoreWebView2ExperimentalWebResourceResponseReceivedEventArgs

Note

This an experimental API that is shipped with our prerelease SDK. See WebView2 release notes.

interface ICoreWebView2ExperimentalWebResourceResponseReceivedEventArgs
  : public IUnknown

Event args for the WebResourceResponseReceived event.

Summary

Members Descriptions
get_Request Web resource request object. Any modifications to this object will be ignored.
get_Response Web resource response object.
PopulateResponseContent Async method to request the Content stream of the response.

Will contain the request as it was sent and the response as it was received. Note: To get the response content stream, first call PopulateResponseContent and wait for the async call to complete, otherwise the content stream object returned will be null.

Members

get_Request

Web resource request object. Any modifications to this object will be ignored.

public HRESULT get_Request(ICoreWebView2WebResourceRequest ** request)

get_Response

Web resource response object.

public HRESULT get_Response(ICoreWebView2WebResourceResponse ** response)

Any modifications to this object will be ignored.

PopulateResponseContent

Async method to request the Content stream of the response.

public HRESULT PopulateResponseContent(ICoreWebView2ExperimentalWebResourceResponseReceivedEventArgsPopulateResponseContentCompletedHandler * handler)

                    args->PopulateResponseContent(
                        Callback<
                            ICoreWebView2ExperimentalWebResourceResponseReceivedEventArgsPopulateResponseContentCompletedHandler>(
                            [this, webResourceRequest, webResourceResponse](HRESULT result) {
                                std::wstring message =
                                    L"{ \"kind\": \"event\", \"name\": "
                                    L"\"WebResourceResponseReceived\", \"args\": {"
                                    L"\"request\": " +
                                    RequestToJsonString(webResourceRequest.get()) +
                                    L", "
                                    L"\"response\": " +
                                    ResponseToJsonString(webResourceResponse.get()) + L"}";

                                message +=
                                    WebViewPropertiesToJsonString(m_webviewEventSource.get());
                                message += L"}";
                                PostEventMessage(message);
                                return S_OK;
                            })
                            .Get());