Skip to content

Commit 2c23f83

Browse files
committed
fix isBase64encoded for external rewrites
1 parent 6884444 commit 2c23f83

File tree

1 file changed

+6
-6
lines changed
  • packages/open-next/src/overrides/proxyExternalRequest

1 file changed

+6
-6
lines changed

packages/open-next/src/overrides/proxyExternalRequest/node.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ const nodeProxy: ProxyExternalRequest = {
4747
rejectUnauthorized: false,
4848
},
4949
(_res) => {
50+
const resHeaders = _res.headers;
5051
const nodeReadableStream =
51-
_res.headers["content-encoding"] === "br"
52+
resHeaders["content-encoding"] === "br"
5253
? _res.pipe(require("node:zlib").createBrotliDecompress())
53-
: _res.headers["content-encoding"] === "gzip"
54+
: resHeaders["content-encoding"] === "gzip"
5455
? _res.pipe(require("node:zlib").createGunzip())
5556
: _res;
56-
5757
const isBase64Encoded =
58-
isBinaryContentType(headers["content-type"]) ||
59-
!!headers["content-encoding"];
58+
isBinaryContentType(resHeaders["content-type"]) ||
59+
!!resHeaders["content-encoding"];
6060
const result: InternalResult = {
6161
type: "core",
62-
headers: filterHeadersForProxy(_res.headers),
62+
headers: filterHeadersForProxy(resHeaders),
6363
statusCode: _res.statusCode ?? 200,
6464
// TODO: check base64 encoding
6565
isBase64Encoded,

0 commit comments

Comments
 (0)