summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorKurt Mackey <mrkurt@gmail.com>2019-05-02 23:52:50 -0500
committerRyan Dahl <ry@tinyclouds.org>2019-05-03 00:52:50 -0400
commit4d4dcafb96bdffa3050e863df0ef4ddd158ebf16 (patch)
tree2822dd0da6f56ebdc538a24ca18fb9e60cbc757b /js
parent00ac871607a7aeff1f6ac90f10090f07be9ccf73 (diff)
fixes body formData tests disabled in #2268 (#2274)
Diffstat (limited to 'js')
-rw-r--r--js/body_test.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/js/body_test.ts b/js/body_test.ts
index 1b6157c12..f2daf725e 100644
--- a/js/body_test.ts
+++ b/js/body_test.ts
@@ -1,5 +1,5 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEquals } from "./test_util.ts";
+import { test, testPerm, assertEquals, assert } from "./test_util.ts";
// just a hack to get a body object
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -32,7 +32,6 @@ test(async function arrayBufferFromByteArrays(): Promise<void> {
});
//FormData
-/* TODO(ry) Re-enable this test.
testPerm({ net: true }, async function bodyMultipartFormData(): Promise<void> {
const response = await fetch(
"http://localhost:4545/tests/subdir/multipart_form_data.txt"
@@ -40,6 +39,10 @@ testPerm({ net: true }, async function bodyMultipartFormData(): Promise<void> {
const text = await response.text();
const body = buildBody(text);
+
+ // @ts-ignore
+ body.contentType = "multipart/form-data;boundary=boundary";
+
const formData = await body.formData();
assert(formData.has("field_1"));
assertEquals(formData.get("field_1").toString(), "value_1 \r\n");
@@ -53,10 +56,13 @@ testPerm({ net: true }, async function bodyURLEncodedFormData(): Promise<void> {
const text = await response.text();
const body = buildBody(text);
+
+ // @ts-ignore
+ body.contentType = "application/x-www-form-urlencoded";
+
const formData = await body.formData();
assert(formData.has("field_1"));
assertEquals(formData.get("field_1").toString(), "Hi");
assert(formData.has("field_2"));
assertEquals(formData.get("field_2").toString(), "<Deno>");
});
-*/