From f6a41469730e8dcd0995d3e5dd370b9410c65ba4 Mon Sep 17 00:00:00 2001 From: Chris Couzens Date: Wed, 24 Jun 2020 04:56:05 +0100 Subject: fix(cli/web): Support URLSearchParam as Body (#6416) The following used to fail in Deno despite working in the browser: ```javascript new Request('http://localhost/', {method: 'POST', body: new URLSearchParams({hello: 'world'})}).text().then(console.log) ``` --- cli/tests/unit/body_test.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cli/tests') diff --git a/cli/tests/unit/body_test.ts b/cli/tests/unit/body_test.ts index a6df3102e..df824e1ae 100644 --- a/cli/tests/unit/body_test.ts +++ b/cli/tests/unit/body_test.ts @@ -72,3 +72,10 @@ unitTest( assertEquals(formData.get("field_2")!.toString(), ""); } ); + +unitTest({ perms: {} }, async function bodyURLSearchParams(): Promise { + const body = buildBody(new URLSearchParams({ hello: "world" })); + + const text = await body.text(); + assertEquals(text, "hello=world"); +}); -- cgit v1.2.3