diff options
author | Marcos Casagrande <marcoscvp90@gmail.com> | 2020-05-25 15:26:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-25 09:26:36 -0400 |
commit | 1c4a9665e2a2ff85ccb8060f168dafafa4d2194b (patch) | |
tree | 640e4d2d9e743b8dec8430f9ad9e4fd3751bf38e /cli/tests/unit/fetch_test.ts | |
parent | c9f0e34e294241541ba59c3a7eb52f42df7ff993 (diff) |
fix: Allow ArrayBuffer as Fetch request body (#5831)
Diffstat (limited to 'cli/tests/unit/fetch_test.ts')
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index 458c34ae2..db4c3a407 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -260,6 +260,19 @@ unitTest( unitTest( { perms: { net: true } }, + async function fetchInitArrayBufferBody(): Promise<void> { + const data = "Hello World"; + const response = await fetch("http://localhost:4545/echo_server", { + method: "POST", + body: new TextEncoder().encode(data).buffer, + }); + const text = await response.text(); + assertEquals(text, data); + } +); + +unitTest( + { perms: { net: true } }, async function fetchInitURLSearchParamsBody(): Promise<void> { const data = "param1=value1¶m2=value2"; const params = new URLSearchParams(data); |