Skip to content

Commit

Permalink
Request extra headers on Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
MorbZ committed Feb 16, 2019
1 parent 5acd015 commit 107d475
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "No PDF Download",
"description": "Opens all PDF files directly in the browser.",
"version": "1.0.3",
"version": "1.0.4",

"permissions": [
"webRequest",
Expand Down
15 changes: 11 additions & 4 deletions app/src/background.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
'use strict';

// For Chrome we have to use "extraHeaders" to get the cookie header
let extraInfoSpec = [
'responseHeaders',
'blocking',
];
if(chrome.webRequest.OnBeforeSendHeadersOptions.hasOwnProperty('EXTRA_HEADERS')) {
extraInfoSpec.push('extraHeaders');
}

// Register receiver for reponse headers
chrome.webRequest.onHeadersReceived.addListener(
(details) => {
let newHeaders = handleHeaders(details.url, details.responseHeaders);
Expand All @@ -16,8 +26,5 @@ chrome.webRequest.onHeadersReceived.addListener(
],
urls: ['<all_urls>'],
},
[
'responseHeaders',
'blocking',
]
extraInfoSpec
);

0 comments on commit 107d475

Please sign in to comment.