From 1c4028a381b397e97e88dfb3564616247312a888 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Wed, 18 May 2022 16:16:11 +0200 Subject: fix: add types for `Response.json` (#14655) --- cli/tests/unit/fetch_test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cli/tests') diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index bfd5bc991..0720a0531 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -1533,3 +1533,12 @@ Deno.test( assertEquals(length, 'Some("4")'); }, ); + +Deno.test(async function staticResponseJson() { + const data = { hello: "world" }; + const resp = Response.json(data); + assertEquals(resp.status, 200); + assertEquals(resp.headers.get("content-type"), "application/json"); + const res = await resp.json(); + assertEquals(res, data); +}); -- cgit v1.2.3