Minor Change (oops)

This commit is contained in:
TheEmeraldStarr 2021-08-08 14:55:47 -07:00
parent af2ca7e034
commit 6bd7e10c4d
31 changed files with 34771 additions and 1 deletions

View file

@ -0,0 +1,22 @@
const zlib = require('zlib');
function decompress(ctx) {
if (!ctx.body || !ctx.remoteResponse) return;
try {
switch(ctx.headers['content-encoding']) {
case 'br':
ctx.body = zlib.brotliDecompressSync(ctx.body);
break;
case 'gzip':
ctx.body = zlib.gunzipSync(ctx.body);
break;
case 'deflate':
ctx.body = zlib.inflateRawSync(ctx.body);
break;
};
} catch(err) {};
delete ctx.headers['content-encoding'];
return true;
};
module.exports = decompress;