diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2023-12-25 08:58:51 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-25 08:58:51 +0530 |
commit | 60da9d493c97fdfa026d163f80ddc25ee01a6e57 (patch) | |
tree | d97ead9db23f66a5a3be84eccddcf08dd584cc29 /cli/tests | |
parent | 8702894feb480181040152a06e7c3eaf38619629 (diff) |
fix(ext/node): add ClientRequest#setNoDelay (#21694)
Fixes https://github.com/denoland/deno/issues/18316
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/unit_node/http_test.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cli/tests/unit_node/http_test.ts b/cli/tests/unit_node/http_test.ts index 5285d8e23..72525d803 100644 --- a/cli/tests/unit_node/http_test.ts +++ b/cli/tests/unit_node/http_test.ts @@ -584,6 +584,27 @@ Deno.test("[node/http] ClientRequest setTimeout", async () => { assertEquals(body, "HTTP/1.1"); }); +Deno.test("[node/http] ClientRequest setNoDelay", async () => { + let body = ""; + const { promise, resolve, reject } = Promise.withResolvers<void>(); + const timer = setTimeout(() => reject("timed out"), 50000); + const req = http.request("http://localhost:4545/http_version", (resp) => { + resp.on("data", (chunk) => { + body += chunk; + }); + + resp.on("end", () => { + resolve(); + }); + }); + req.setNoDelay(true); + req.once("error", (e) => reject(e)); + req.end(); + await promise; + clearTimeout(timer); + assertEquals(body, "HTTP/1.1"); +}); + Deno.test("[node/http] ClientRequest PATCH", async () => { let body = ""; const { promise, resolve, reject } = Promise.withResolvers<void>(); |