diff options
author | Marcos Casagrande <marcoscvp90@gmail.com> | 2020-05-28 15:02:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-28 09:02:00 -0400 |
commit | c9bbb200d6938e63081da97f77fb95f5322ec918 (patch) | |
tree | 4ea04718508c7a37aea328a8d1d589564ac4a524 /cli/tests/unit/fetch_test.ts | |
parent | 3cbcdd4250cda17cbafa8efdfc296b79d0f6d5c0 (diff) |
formData: set default filename for Blob to <blob> (#5907)
Diffstat (limited to 'cli/tests/unit/fetch_test.ts')
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index 4a4212c0c..2738eba5e 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -359,6 +359,24 @@ unitTest( } ); +unitTest( + { perms: { net: true } }, + async function fetchInitFormDataBlobFilenameBody(): Promise<void> { + const form = new FormData(); + form.append("field", "value"); + form.append("file", new Blob([new TextEncoder().encode("deno")])); + 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")); + const file = resultForm.get("file"); + assert(file instanceof File); + assertEquals(file.name, "blob"); + } +); + unitTest({ perms: { net: true } }, async function fetchUserAgent(): Promise< void > { |