aboutsummaryrefslogtreecommitdiff
path: root/test/js/node/http/node-http.test.ts
diff options
context:
space:
mode:
authorGravatar Ciro Spaciari <ciro.spaciari@gmail.com> 2023-08-30 13:50:09 -0300
committerGravatar GitHub <noreply@github.com> 2023-08-30 13:50:09 -0300
commit908018a4df5b03168988993f0b664d9443fca381 (patch)
tree0050aa856c245713457b5e59c7c3efee2d3c7c77 /test/js/node/http/node-http.test.ts
parentf24ca3900400bb41faefb42f426651d5d7e7c2e6 (diff)
downloadbun-908018a4df5b03168988993f0b664d9443fca381.tar.gz
bun-908018a4df5b03168988993f0b664d9443fca381.tar.zst
bun-908018a4df5b03168988993f0b664d9443fca381.zip
fix(http/https) disable decompress on http/https client (#4399)
* disable decompress on http/https module * make js again
Diffstat (limited to 'test/js/node/http/node-http.test.ts')
-rw-r--r--test/js/node/http/node-http.test.ts15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/js/node/http/node-http.test.ts b/test/js/node/http/node-http.test.ts
index 64beba25b..619718fee 100644
--- a/test/js/node/http/node-http.test.ts
+++ b/test/js/node/http/node-http.test.ts
@@ -260,7 +260,7 @@ describe("node:http", () => {
});
it("should make a https:// GET request when passed string as first arg", done => {
- const req = request("https://example.com", res => {
+ const req = request("https://example.com", { headers: { "accept-encoding": "identity" } }, res => {
let data = "";
res.setEncoding("utf8");
res.on("data", chunk => {
@@ -629,6 +629,7 @@ describe("node:http", () => {
path: "http://example.com",
headers: {
Host: "example.com",
+ "accept-encoding": "identity",
},
};
@@ -825,7 +826,17 @@ describe("node:http", () => {
}
});
});
-
+ test("should not decompress gzip, issue#4397", async () => {
+ const { promise, resolve } = Promise.withResolvers();
+ request("https://bun.sh/", { headers: { "accept-encoding": "gzip" } }, res => {
+ res.on("data", function cb(chunk) {
+ resolve(chunk);
+ res.off("data", cb);
+ });
+ }).end();
+ const chunk = await promise;
+ expect(chunk.toString()).not.toContain("<html");
+ });
test("test unix socket server", done => {
const socketPath = `${tmpdir()}/bun-server-${Math.random().toString(32)}.sock`;
const server = createServer((req, res) => {