summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit_node/http_test.ts16
1 files changed, 13 insertions, 3 deletions
diff --git a/cli/tests/unit_node/http_test.ts b/cli/tests/unit_node/http_test.ts
index c8c2a52a2..adeaf466d 100644
--- a/cli/tests/unit_node/http_test.ts
+++ b/cli/tests/unit_node/http_test.ts
@@ -713,11 +713,17 @@ Deno.test(
"[node/http] client end with callback",
{ permissions: { net: true } },
async () => {
+ let received = false;
+ const ac = new AbortController();
+ const server = Deno.serve({ port: 5928, signal: ac.signal }, (_req) => {
+ received = true;
+ return new Response("hello");
+ });
const promise = deferred();
let body = "";
const request = http.request(
- "http://localhost:4545/http_version",
+ "http://localhost:5928/",
(resp) => {
resp.on("data", (chunk) => {
body += chunk;
@@ -729,10 +735,14 @@ Deno.test(
},
);
request.on("error", promise.reject);
- request.end();
+ request.end(() => {
+ assert(received);
+ });
await promise;
+ ac.abort();
+ await server.finished;
- assertEquals(body, "HTTP/1.1");
+ assertEquals(body, "hello");
},
);