summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2021-08-13 12:07:05 +0200
committerGitHub <noreply@github.com>2021-08-13 12:07:05 +0200
commit2937f02f00b427bffe1509a40459e02aa62e47b0 (patch)
tree77b55bd12ccaf52d1b61477ae74644a936fd4bc6 /cli/tests
parentebb79b28a5e1689a1d198082b35d37a4541d2a90 (diff)
fix(ext/http): remove unwrap() when HTTP conn errors (#11674)
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/http_test.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/cli/tests/unit/http_test.ts b/cli/tests/unit/http_test.ts
index d762a6497..5262c5919 100644
--- a/cli/tests/unit/http_test.ts
+++ b/cli/tests/unit/http_test.ts
@@ -731,3 +731,23 @@ unitTest({ perms: { net: true } }, async function httpCookieConcatenation() {
assertEquals(text, "ok");
await promise;
});
+
+// https://github.com/denoland/deno/issues/11651
+unitTest({ perms: { net: true } }, async function httpServerPanic() {
+ const listener = Deno.listen({ port: 4501 });
+ const client = await Deno.connect({ port: 4501 });
+ const conn = await listener.accept();
+ const httpConn = Deno.serveHttp(conn);
+
+ // This message is incomplete on purpose, we'll forcefully close client connection
+ // after it's flushed to cause connection to error out on the server side.
+ const encoder = new TextEncoder();
+ await client.write(encoder.encode("GET / HTTP/1.1"));
+
+ httpConn.nextRequest();
+ await client.write(encoder.encode("\r\n\r\n"));
+ httpConn.close();
+
+ client.close();
+ listener.close();
+});