summaryrefslogtreecommitdiff
path: root/cli/js/fetch_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js/fetch_test.ts')
-rw-r--r--cli/js/fetch_test.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/cli/js/fetch_test.ts b/cli/js/fetch_test.ts
index 2b3d03a38..c63d05501 100644
--- a/cli/js/fetch_test.ts
+++ b/cli/js/fetch_test.ts
@@ -54,7 +54,7 @@ testPerm({ net: true }, async function fetchHeaders(): Promise<void> {
const response = await fetch("http://localhost:4545/cli/tests/fixture.json");
const headers = response.headers;
assertEquals(headers.get("Content-Type"), "application/json");
- assert(headers.get("Server").startsWith("SimpleHTTP"));
+ assert(headers.get("Server")!.startsWith("SimpleHTTP"));
});
testPerm({ net: true }, async function fetchBlob(): Promise<void> {
@@ -93,10 +93,10 @@ testPerm({ net: true }, async function responseClone(): Promise<void> {
assert(response !== response1);
assertEquals(response.status, response1.status);
assertEquals(response.statusText, response1.statusText);
- const ab = await response.arrayBuffer();
- const ab1 = await response1.arrayBuffer();
- for (let i = 0; i < ab.byteLength; i++) {
- assertEquals(ab[i], ab1[i]);
+ const u8a = new Uint8Array(await response.arrayBuffer());
+ const u8a1 = new Uint8Array(await response1.arrayBuffer());
+ for (let i = 0; i < u8a.byteLength; i++) {
+ assertEquals(u8a[i], u8a1[i]);
}
});
@@ -119,7 +119,7 @@ testPerm({ net: true }, async function fetchMultipartFormDataSuccess(): Promise<
);
const formData = await response.formData();
assert(formData.has("field_1"));
- assertEquals(formData.get("field_1").toString(), "value_1 \r\n");
+ assertEquals(formData.get("field_1")!.toString(), "value_1 \r\n");
assert(formData.has("field_2"));
/* TODO(ry) Re-enable this test once we bring back the global File type.
const file = formData.get("field_2") as File;
@@ -136,9 +136,9 @@ testPerm(
);
const formData = await response.formData();
assert(formData.has("field_1"));
- assertEquals(formData.get("field_1").toString(), "Hi");
+ assertEquals(formData.get("field_1")!.toString(), "Hi");
assert(formData.has("field_2"));
- assertEquals(formData.get("field_2").toString(), "<Deno>");
+ assertEquals(formData.get("field_2")!.toString(), "<Deno>");
}
);
@@ -179,7 +179,7 @@ testPerm({ net: true }, async function fetchInitStringBody(): Promise<void> {
});
const text = await response.text();
assertEquals(text, data);
- assert(response.headers.get("content-type").startsWith("text/plain"));
+ assert(response.headers.get("content-type")!.startsWith("text/plain"));
});
testPerm({ net: true }, async function fetchRequestInitStringBody(): Promise<
@@ -220,7 +220,7 @@ testPerm({ net: true }, async function fetchInitURLSearchParamsBody(): Promise<
assertEquals(text, data);
assert(
response.headers
- .get("content-type")
+ .get("content-type")!
.startsWith("application/x-www-form-urlencoded")
);
});
@@ -236,7 +236,7 @@ testPerm({ net: true }, async function fetchInitBlobBody(): Promise<void> {
});
const text = await response.text();
assertEquals(text, data);
- assert(response.headers.get("content-type").startsWith("text/javascript"));
+ assert(response.headers.get("content-type")!.startsWith("text/javascript"));
});
testPerm({ net: true }, async function fetchUserAgent(): Promise<void> {