This commit is contained in:
Rizky 2024-06-21 12:45:09 +07:00
parent 1309a9db3e
commit bef936f5d0
1 changed files with 10 additions and 0 deletions

View File

@ -36,6 +36,16 @@ export const _ = {
res_headers[k] = v;
});
res_body = await res.arrayBuffer();
if (res_headers["content-encoding"] === "gzip") {
res_body = await gzipAsync(new Uint8Array(res_body));
delete res_headers["content-encoding"];
} else if (res_headers["content-encoding"] === "zstd") {
res_body = await decompress(res_body);
delete res_headers["content-encoding"];
} else if (res_headers["content-encoding"] === "br") {
res_body = await brotli.decompress(res_body);
delete res_headers["content-encoding"];
}
return new Response(res_body, { headers: res_headers });
} catch (e: any) {