Merge pull request #1604 from deepak1556/contents_event_patch
webContents: providing response headers in did-get-response-details event
This commit is contained in:
commit
6f806190b6
4 changed files with 15 additions and 2 deletions
|
@ -37,6 +37,7 @@
|
|||
#include "native_mate/callback.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "native_mate/object_template_builder.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
|
||||
|
@ -278,13 +279,20 @@ void WebContents::DidStopLoading(content::RenderViewHost* render_view_host) {
|
|||
|
||||
void WebContents::DidGetResourceResponseStart(
|
||||
const content::ResourceRequestDetails& details) {
|
||||
auto context = static_cast<brightray::BrowserContext*>(
|
||||
web_contents()->GetBrowserContext());
|
||||
std::string headers;
|
||||
if (context)
|
||||
headers = context->GetNetworkDelegate()->GetResponseHeaders(details.url);
|
||||
|
||||
Emit("did-get-response-details",
|
||||
details.socket_address.IsEmpty(),
|
||||
details.url,
|
||||
details.original_url,
|
||||
details.http_response_code,
|
||||
details.method,
|
||||
details.referrer);
|
||||
details.referrer,
|
||||
headers);
|
||||
}
|
||||
|
||||
void WebContents::DidGetRedirectForResourceRequest(
|
||||
|
|
|
@ -10,7 +10,8 @@ WEB_VIEW_EVENTS =
|
|||
'did-start-loading': []
|
||||
'did-stop-loading': []
|
||||
'did-get-response-details': ['status', 'newUrl', 'originalUrl',
|
||||
'httpResponseCode', 'requestMethod', 'referrer']
|
||||
'httpResponseCode', 'requestMethod', 'referrer',
|
||||
'headers']
|
||||
'did-get-redirect-request': ['oldUrl', 'newUrl', 'isMainFrame']
|
||||
'dom-ready': []
|
||||
'console-message': ['level', 'message', 'line', 'sourceId']
|
||||
|
|
|
@ -666,9 +666,11 @@ Corresponds to the points in time when the spinner of the tab stops spinning.
|
|||
* `httpResponseCode` Integer
|
||||
* `requestMethod` String
|
||||
* `referrer` String
|
||||
* `headers` String
|
||||
|
||||
Emitted when details regarding a requested resource is available.
|
||||
`status` indicates the socket connection to download the resource.
|
||||
`headers` is key-value string separated by new-line character.
|
||||
|
||||
### Event: 'did-get-redirect-request'
|
||||
|
||||
|
|
|
@ -325,9 +325,11 @@ Corresponds to the points in time when the spinner of the tab stops spinning.
|
|||
* `httpResponseCode` Integer
|
||||
* `requestMethod` String
|
||||
* `referrer` String
|
||||
* `headers` String
|
||||
|
||||
Fired when details regarding a requested resource is available.
|
||||
`status` indicates socket connection to download the resource.
|
||||
`headers` is key-value string separated by new-line character.
|
||||
|
||||
### did-get-redirect-request
|
||||
|
||||
|
|
Loading…
Reference in a new issue