summaryrefslogtreecommitdiff
path: root/cli/tests/unit/fetch_test.ts
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2022-05-18 16:16:11 +0200
committerGitHub <noreply@github.com>2022-05-18 16:16:11 +0200
commit1c4028a381b397e97e88dfb3564616247312a888 (patch)
tree9f9fce9697767a6f3ee6ca020b1e1275dc6650fb /cli/tests/unit/fetch_test.ts
parentf2410b4481ec4e2cda804fe05d30273bba3d4008 (diff)
fix: add types for `Response.json` (#14655)
Diffstat (limited to 'cli/tests/unit/fetch_test.ts')
-rw-r--r--cli/tests/unit/fetch_test.ts9
1 files changed, 9 insertions, 0 deletions
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);
+});