summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/tests/unit/http_test.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/cli/tests/unit/http_test.ts b/cli/tests/unit/http_test.ts
index f7ea3a75a..6383afd42 100644
--- a/cli/tests/unit/http_test.ts
+++ b/cli/tests/unit/http_test.ts
@@ -200,3 +200,30 @@ unitTest(
client.close();
},
);
+
+unitTest(
+ { perms: { net: true } },
+ async function httpServerRegressionHang() {
+ const promise = (async () => {
+ const listener = Deno.listen({ port: 4501 });
+ const conn = await listener.accept();
+ const httpConn = Deno.serveHttp(conn);
+ const event = await httpConn.nextRequest();
+ assert(event);
+ const { request, respondWith } = event;
+ const reqBody = await request.text();
+ assertEquals("request", reqBody);
+ await respondWith(new Response("response"));
+ httpConn.close();
+ listener.close();
+ })();
+
+ const resp = await fetch("http://127.0.0.1:4501/", {
+ method: "POST",
+ body: "request",
+ });
+ const respBody = await resp.text();
+ assertEquals("response", respBody);
+ await promise;
+ },
+);