summaryrefslogtreecommitdiff
path: root/cli/tests/unit/fetch_test.ts
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2020-05-28 15:02:00 +0200
committerGitHub <noreply@github.com>2020-05-28 09:02:00 -0400
commitc9bbb200d6938e63081da97f77fb95f5322ec918 (patch)
tree4ea04718508c7a37aea328a8d1d589564ac4a524 /cli/tests/unit/fetch_test.ts
parent3cbcdd4250cda17cbafa8efdfc296b79d0f6d5c0 (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.ts18
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
> {