]> khamidou — GitHub mirrors - electron.git/commitdiff
Add extra headers option to webContents.loadUrl
authorGohy Leandre <leandre.gohy@hexeo.be>
Mon, 26 Oct 2015 21:18:16 +0000 (22:18 +0100)
committerGohy Leandre <leandre.gohy@hexeo.be>
Mon, 26 Oct 2015 21:18:16 +0000 (22:18 +0100)
atom/browser/api/atom_api_web_contents.cc
docs/api/web-contents.md

index 5b3ef2f4aa7b61509d6e36415c221c408a505d8b..900c3e65a37699495ad266c788f67f9fab0c7bd9 100644 (file)
@@ -618,6 +618,10 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
   if (options.Get("userAgent", &user_agent))
     SetUserAgent(user_agent);
 
+  std::string extra_headers;
+  if (options.Get("extraHeaders", &extra_headers))
+    params.extra_headers = extra_headers;
+
   params.transition_type = ui::PAGE_TRANSITION_TYPED;
   params.should_clear_history_list = true;
   params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE;
index 7633efbfb3de5a484cf682484234f61f19746bec..3113356e34b43d0b19a698bc3d3b4bfd5caeefcc 100644 (file)
@@ -183,6 +183,7 @@ See [session documentation](session.md) for this object's methods.
 * `options` Object (optional), properties:
   * `httpReferrer` String - A HTTP Referrer url.
   * `userAgent` String - A user agent originating the request.
+  * `extraHeaders` String - Extra headers separated by "\n"
 
 Loads the `url` in the window, the `url` must contain the protocol prefix,
 e.g. the `http://` or `file://`.