diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2021-05-21 10:11:53 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-21 10:11:53 +0900 |
commit | 4a9b40b717dc7e5be59bbd4e56670d27995faf58 (patch) | |
tree | 7ad5eedef4e752733ce96d99fc380c495727d155 /cli/tests/unit/http_test.ts | |
parent | 8708d3c0451129792d58b7fa856101ceaa7bf487 (diff) |
fix(runtime/http): fix empty blob response (#10689)
Diffstat (limited to 'cli/tests/unit/http_test.ts')
-rw-r--r-- | cli/tests/unit/http_test.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cli/tests/unit/http_test.ts b/cli/tests/unit/http_test.ts index d4c35545f..9560394f0 100644 --- a/cli/tests/unit/http_test.ts +++ b/cli/tests/unit/http_test.ts @@ -317,3 +317,25 @@ unitTest( await promise; }, ); + +unitTest( + { perms: { net: true } }, + async function httpServerEmptyBlobResponse() { + 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 { respondWith } = event; + await respondWith(new Response(new Blob([]))); + httpConn.close(); + listener.close(); + })(); + + const resp = await fetch("http://127.0.0.1:4501/"); + const respBody = await resp.text(); + assertEquals("", respBody); + await promise; + }, +); |