diff options
Diffstat (limited to 'cli/tests/unit/flash_test.ts')
-rw-r--r-- | cli/tests/unit/flash_test.ts | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/cli/tests/unit/flash_test.ts b/cli/tests/unit/flash_test.ts index 5604f6b5f..706b9f72b 100644 --- a/cli/tests/unit/flash_test.ts +++ b/cli/tests/unit/flash_test.ts @@ -2328,6 +2328,45 @@ Deno.test( }, ); +// https://github.com/denoland/deno/issues/15858 +Deno.test( + { permissions: { net: true } }, + async function httpServerCanCloneRequest() { + const ac = new AbortController(); + const listeningPromise = deferred(); + + const server = Deno.serve({ + handler: async (req) => { + const cloned = req.clone(); + assertEquals(req.headers, cloned.headers); + + // both requests can read body + await req.text(); + await cloned.json(); + + return new Response("ok"); + }, + signal: ac.signal, + onListen: onListen(listeningPromise), + onError: createOnErrorCb(ac), + }); + + try { + await listeningPromise; + const resp = await fetch("http://localhost:9000/", { + headers: { connection: "close" }, + method: "POST", + body: '{"sus":true}', + }); + const text = await resp.text(); + assertEquals(text, "ok"); + } finally { + ac.abort(); + await server; + } + }, +); + // Checks large streaming response // https://github.com/denoland/deno/issues/16567 Deno.test( |