From 39df200ac91d3fdf889cff3a69602c1e8228da25 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 19:08:43 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- test/js/node/http/node-http.test.ts | 18 +++++++++--------- test/regression/issue/21620.test.ts | 28 ++++++++++++++-------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/test/js/node/http/node-http.test.ts b/test/js/node/http/node-http.test.ts index 6cafd048f0..4940eb5429 100644 --- a/test/js/node/http/node-http.test.ts +++ b/test/js/node/http/node-http.test.ts @@ -3081,7 +3081,7 @@ test("should handle invalid method", async () => { test("multiple request writes should not hang (issue #21620)", async () => { const { promise, resolve, reject } = Promise.withResolvers(); let responseReceived = false; - + await using server = http.createServer((req, res) => { let body = ""; req.on("data", chunk => { @@ -3098,7 +3098,7 @@ test("multiple request writes should not hang (issue #21620)", async () => { const address = server.address() as AddressInfo; const jsonStr = JSON.stringify({ key: "val", key2: 200 }); - + const req = http.request( { hostname: "localhost", @@ -3108,7 +3108,7 @@ test("multiple request writes should not hang (issue #21620)", async () => { "content-type": "application/json", }, }, - (res) => { + res => { let data = ""; res.on("data", chunk => { data += chunk.toString(); @@ -3123,7 +3123,7 @@ test("multiple request writes should not hang (issue #21620)", async () => { reject(err); } }); - } + }, ); req.on("error", reject); @@ -3155,7 +3155,7 @@ test("multiple request writes should not hang (issue #21620)", async () => { test("multiple https request writes should not hang", async () => { const { promise, resolve, reject } = Promise.withResolvers(); let responseReceived = false; - + await using server = https.createServer(COMMON_TLS_CERT, (req, res) => { let body = ""; req.on("data", chunk => { @@ -3172,7 +3172,7 @@ test("multiple https request writes should not hang", async () => { const address = server.address() as AddressInfo; const jsonStr = JSON.stringify({ key: "val", key2: 200 }); - + const req = https.request( { hostname: "localhost", @@ -3183,7 +3183,7 @@ test("multiple https request writes should not hang", async () => { }, rejectUnauthorized: false, // For test cert }, - (res) => { + res => { let data = ""; res.on("data", chunk => { data += chunk.toString(); @@ -3198,12 +3198,12 @@ test("multiple https request writes should not hang", async () => { reject(err); } }); - } + }, ); req.on("error", reject); - // Add timeout to prevent hanging + // Add timeout to prevent hanging const timeout = setTimeout(() => { if (!responseReceived) { req.destroy(); diff --git a/test/regression/issue/21620.test.ts b/test/regression/issue/21620.test.ts index 0e8222abe6..2ca120be8a 100644 --- a/test/regression/issue/21620.test.ts +++ b/test/regression/issue/21620.test.ts @@ -2,7 +2,7 @@ * Regression test for issue #21620 - Multiple data writes on outgoing http/https request cause the connection to hang * @see https://github.com/oven-sh/bun/issues/21620 */ -import { test, expect } from "bun:test"; +import { expect, test } from "bun:test"; import { once } from "node:events"; import http from "node:http"; import https from "node:https"; @@ -25,13 +25,13 @@ lCECIQDcOTGFE7gU6zW8bV2b1JzG1Hv5jJiO2xON9U3qxnKNZwIhAOKGOLQcHrOO hGdJWp5YTJD5K3vxrW6HzfN/Lr8yTpGVAiEA4mD8YjQxuCJ3yDY1zR5U2n7rE5ON LYZa5GGl9g5w6YMCIQDH4U+7K3mw7yV3U6gHfLaV0+6nOW9l1lCY2vXzjUr5HQIg YMU+J1Y5SBo9PHLLqJQ9E3mH2LZU7q9Z9lkJdA+6TnE= ------END RSA PRIVATE KEY-----` +-----END RSA PRIVATE KEY-----`, }; test("multiple http request writes should not hang (issue #21620)", async () => { const { promise, resolve, reject } = Promise.withResolvers(); let responseReceived = false; - + await using server = http.createServer((req, res) => { let body = ""; req.on("data", chunk => { @@ -48,7 +48,7 @@ test("multiple http request writes should not hang (issue #21620)", async () => const address = server.address() as AddressInfo; const jsonStr = JSON.stringify({ key: "val", key2: 200 }); - + const req = http.request( { hostname: "localhost", @@ -58,7 +58,7 @@ test("multiple http request writes should not hang (issue #21620)", async () => "content-type": "application/json", }, }, - (res) => { + res => { let data = ""; res.on("data", chunk => { data += chunk.toString(); @@ -73,7 +73,7 @@ test("multiple http request writes should not hang (issue #21620)", async () => reject(err); } }); - } + }, ); req.on("error", reject); @@ -88,7 +88,7 @@ test("multiple http request writes should not hang (issue #21620)", async () => // Multiple writes should not cause hanging req.write(jsonStr.slice(0, 10)); - + // Add small delay between writes to trigger the race condition setTimeout(() => { req.write(jsonStr.slice(10)); @@ -107,7 +107,7 @@ test("multiple http request writes should not hang (issue #21620)", async () => test("multiple https request writes should not hang (issue #21620)", async () => { const { promise, resolve, reject } = Promise.withResolvers(); let responseReceived = false; - + await using server = https.createServer(COMMON_TLS_CERT, (req, res) => { let body = ""; req.on("data", chunk => { @@ -124,7 +124,7 @@ test("multiple https request writes should not hang (issue #21620)", async () => const address = server.address() as AddressInfo; const jsonStr = JSON.stringify({ key: "val", key2: 200 }); - + const req = https.request( { hostname: "localhost", @@ -135,7 +135,7 @@ test("multiple https request writes should not hang (issue #21620)", async () => }, rejectUnauthorized: false, // For test cert }, - (res) => { + res => { let data = ""; res.on("data", chunk => { data += chunk.toString(); @@ -150,12 +150,12 @@ test("multiple https request writes should not hang (issue #21620)", async () => reject(err); } }); - } + }, ); req.on("error", reject); - // Add timeout to prevent hanging + // Add timeout to prevent hanging const timeout = setTimeout(() => { if (!responseReceived) { req.destroy(); @@ -165,7 +165,7 @@ test("multiple https request writes should not hang (issue #21620)", async () => // Multiple writes should not cause hanging req.write(jsonStr.slice(0, 10)); - + // Add small delay between writes to trigger the race condition setTimeout(() => { req.write(jsonStr.slice(10)); @@ -179,4 +179,4 @@ test("multiple https request writes should not hang (issue #21620)", async () => clearTimeout(timeout); throw err; } -}); \ No newline at end of file +});