diff options
Diffstat (limited to 'std/http')
-rw-r--r-- | std/http/server_test.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/std/http/server_test.ts b/std/http/server_test.ts index 2db44f260..0a4986dcf 100644 --- a/std/http/server_test.ts +++ b/std/http/server_test.ts @@ -462,12 +462,12 @@ test({ async fn(): Promise<void> { async function iteratorReq(server: Server): Promise<void> { for await (const req of server) { - req.respond({ body: new TextEncoder().encode(req.url) }); + await req.respond({ body: new TextEncoder().encode(req.url) }); } } const server = serve(":8123"); - iteratorReq(server); + const p = iteratorReq(server); const conn = await Deno.connect({ hostname: "127.0.0.1", port: 8123 }); await Deno.writeAll( conn, @@ -479,8 +479,7 @@ test({ const resStr = new TextDecoder().decode(res.subarray(0, nread)); assertStrContains(resStr, "/hello"); server.close(); - // Defer to allow async ops to resolve after server has been closed. - await delay(0); + await p; // Client connection should still be open, verify that // it's visible in resource table. const resources = Deno.resources(); |