Re: [whatwg/fetch] Script-created redirects responses have no location URL (#1146)

Ah yeah, #1030 changed that, but we forgot that that this resolved some issues for redirects. It doesn't address the service worker returning non-network redirects however as you note.

I rather like Safari's approach here I have to say of requiring an absolute URL (which can we call option (4)?). Did you check exactly when Safari parses? In particular I wonder if they always parse late or do it perhaps when the `Response` object is constructed.
```js
const response = new Response(null, { status: 302 });
response.headers.set("Location", "https://example.com/");
```
vs
```js
const response = new Response(null, { status: 302, headers: { Location: "https://example.com/" } });
```
If they parse late (which I think is what we want and would also align with a recent change to how we determine the MIME type of a response) this would require no changes to the specification (response's URL would be null and passing null into the URL parser for the base URL does the right thing).

(Though I do want to make an editorial change makes it clear that all responses have the location URL field. Optional fields are rather messy.)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1146#issuecomment-769023905

Received on Thursday, 28 January 2021 12:35:50 UTC