mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-16 18:49:50 +00:00
Bugfix for application/wasm content-type being served with a charset value
This commit is contained in:
15
.proxyrc.js
Normal file
15
.proxyrc.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
module.exports = function(app) {
|
||||||
|
// `app` is an Express instance
|
||||||
|
app.use(function(req, res, next) {
|
||||||
|
const sh = res.setHeader;
|
||||||
|
res.setHeader = function(key, value) {
|
||||||
|
// remove pointless/incorrect charset from binary responses:
|
||||||
|
if (/^content-type$/i.test(key)) {
|
||||||
|
const m = value && value.match(/^(image\/|application\/wasm); charset=.+$/);
|
||||||
|
if (m) value = m[1];
|
||||||
|
}
|
||||||
|
return sh.call(this, key, value);
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user