Last active
June 30, 2018 02:14
-
-
Save DenVdmj/bd6f03481b7a22742d26b27bd6b1b642 to your computer and use it in GitHub Desktop.
Enable brotli supporting for http requests. Chrome extension.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome.webRequest.onBeforeSendHeaders.addListener(details => { | |
let headers = details.requestHeaders; | |
let header = headers.find(header => /accept-encoding/i.test(header.name)); | |
if (header) { | |
header.value = header.value.split(/\s*,\s*/).concat('br').join(', '); | |
} | |
return { requestHeaders: headers } | |
}, { | |
urls: ['*://*/*'] | |
}, [ | |
'blocking', 'requestHeaders' | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest_version": 2, | |
"version": "0.0.1.1", | |
"name": "Brotli for http requests", | |
"description": "Brotli is not only for https requests, but also http requests. This extension just add “br” to “accept-encoding” request header. First and foremost for debugging and site local (WAMP) testing.", | |
"icons": { | |
"32": "brotli-logo-32x32.png", | |
"48": "brotli-logo-48x48.png", | |
"128": "brotli-logo-128x128.png", | |
"256": "brotli-logo-256x256.png" | |
}, | |
"browser_action": { | |
"default_icon": { | |
"32": "brotli-logo-32x32.png", | |
"48": "brotli-logo-48x48.png", | |
"128": "brotli-logo-128x128.png", | |
"256": "brotli-logo-256x256.png" | |
} | |
}, | |
"background": { | |
"scripts": ["background.js"] | |
}, | |
"permissions": [ | |
"tabs", | |
"contextMenus", | |
"webRequest", | |
"webRequestBlocking", | |
"file:///*/*", | |
"*://*/*" | |
], | |
"web_accessible_resources": [ | |
"*://*/*" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment