fix(op_crates/fetch): redirect: "manual" fetch should return type: "default" response (#8353)

This commit is contained in:
Luca Casonato 2020-11-24 21:00:35 +01:00 committed by GitHub
parent 276f529755
commit 501a31fcf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 20 deletions

View file

@ -693,18 +693,10 @@ unitTest(
const response = await fetch("http://localhost:4546/", {
redirect: "manual",
}); // will redirect to http://localhost:4545/
assertEquals(response.status, 0);
assertEquals(response.statusText, "");
assertEquals(response.url, "");
assertEquals(response.type, "opaqueredirect");
try {
await response.text();
fail(
"Reponse.text() didn't throw on a filtered response without a body (type opaqueredirect)",
);
} catch (e) {
return;
}
assertEquals(response.status, 301);
assertEquals(response.url, "http://localhost:4546/");
assertEquals(response.type, "default");
assertEquals(response.headers.get("Location"), "http://localhost:4545/");
},
);