diff options
author | crowlKats <crowlkats@gmail.com> | 2020-03-17 07:32:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-17 02:32:43 -0400 |
commit | 9833975ef21afced84c6a16724ce13d026f09298 (patch) | |
tree | 1a9d76a9bd12c70d362d6feafc37515c66c446c0 /cli/js/tests | |
parent | f9557a4ff6b73a4af37e713bb6b2294253c7b230 (diff) |
feat: fetch should accept a FormData body (#4363)
Diffstat (limited to 'cli/js/tests')
-rw-r--r-- | cli/js/tests/fetch_test.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/js/tests/fetch_test.ts b/cli/js/tests/fetch_test.ts index 146709583..9a705c40a 100644 --- a/cli/js/tests/fetch_test.ts +++ b/cli/js/tests/fetch_test.ts @@ -288,6 +288,20 @@ unitTest({ perms: { net: true } }, async function fetchInitBlobBody(): Promise< assert(response.headers.get("content-type")!.startsWith("text/javascript")); }); +unitTest( + { perms: { net: true } }, + async function fetchInitFormDataBody(): Promise<void> { + const form = new FormData(); + form.append("field", "value"); + const response = await fetch("http://localhost:4545/echo_server", { + method: "POST", + body: form + }); + const resultForm = await response.formData(); + assertEquals(form.get("field"), resultForm.get("field")); + } +); + unitTest({ perms: { net: true } }, async function fetchUserAgent(): Promise< void > { |