summaryrefslogtreecommitdiff
path: root/js/fetch_test.ts
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2019-08-17 07:20:04 +0900
committerRyan Dahl <ry@tinyclouds.org>2019-08-16 18:20:04 -0400
commit9aa9aafbab934b483977683e1ee430abb277833f (patch)
tree61c14f8ee74a00416e83e075897cd33c927bee39 /js/fetch_test.ts
parent81f809f2a675ff4ff7f93231ca87a18cb5b4628e (diff)
fix: set response.url (#2782)
Diffstat (limited to 'js/fetch_test.ts')
-rw-r--r--js/fetch_test.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/js/fetch_test.ts b/js/fetch_test.ts
index 2020716bf..1b59e068a 100644
--- a/js/fetch_test.ts
+++ b/js/fetch_test.ts
@@ -18,6 +18,11 @@ test(async function fetchPerm(): Promise<void> {
assertEquals(err.name, "PermissionDenied");
});
+testPerm({ net: true }, async function fetchUrl(): Promise<void> {
+ const response = await fetch("http://localhost:4545/package.json");
+ assertEquals(response.url, "http://localhost:4545/package.json");
+});
+
testPerm({ net: true }, async function fetchHeaders(): Promise<void> {
const response = await fetch("http://localhost:4545/package.json");
const headers = response.headers;
@@ -102,6 +107,7 @@ testPerm(
testPerm({ net: true }, async function fetchWithRedirection(): Promise<void> {
const response = await fetch("http://localhost:4546/"); // will redirect to http://localhost:4545/
assertEquals(response.status, 200);
+ assertEquals(response.url, "http://localhost:4545/");
const body = await response.text();
assert(body.includes("<title>Directory listing for /</title>"));
});