Response.redirect() currently has two spec mismatches:
Response.redirect("https://example.com").headers.get("location")
// current: "https://example.com"
// expected: "https://example.com/"
try {
Response.redirect("/foo");
console.log("no throw");
} catch (e) {
console.log(e.name);
}
// current: "no throw"
// expected: "TypeError"
The Fetch spec says Response.redirect() should parse the input URL and append the serialized parsed URL to the Location header.
So the current implementation is using the raw input string instead of the serialized parsed URL, and it also accepts relative redirect targets that should fail here.
Response.redirect()currently has two spec mismatches:The Fetch spec says
Response.redirect()should parse the input URL and append the serialized parsed URL to theLocationheader.So the current implementation is using the raw input string instead of the serialized parsed URL, and it also accepts relative redirect targets that should fail here.