Quote from standard:
A request has an associated redirect mode, which is one of "follow", "error", and "manual". Unless stated otherwise, it is "follow".
A request has an associated redirect count. Unless stated otherwise, it is zero.
I don't think this is going to be possible to polyfill on top of XHR.
I don't think this is exposed in the API anyway. Those sentences have no bearing on window.fetch.
@dgraham Hi, can you reopen this issue?
https://www.chromestatus.com/features/4614142321229824
https://fetch.spec.whatwg.org/#requestredirect
JS use:
fetch(new Request(url, {redirect: 'manual'}))
This is a nice addition to the Fetch API, but we won't be able to polyfill it with XMLHttpRequest. The browser navigates all redirects before returning a result, so there is no opportunity to interrupt the redirect flow.
If the response has an HTTP status code of 301, 302, 303, 307, or 308…Set the request URL to the URL conveyed by the Location header…transparently follow the redirect…
That's right but I think we can at least mimic redirect: error using responseURL attribute, (unfortunately) after redirection.
@SaschaNaz We _could_ make a clumsy support for redirect: error, but that would only provide a partial and imperfect support for the redirect setting. I'd rather that we don't support this at all in the polyfill.
@mislav That's reasonable, thanks :)
Is this difference from the standard documented anywhere?
@axelson I don't think so. You're welcome to add it to our documentation in the "gh-pages" branch seen here when published.
Yeyo
Most helpful comment
This is a nice addition to the Fetch API, but we won't be able to polyfill it with
XMLHttpRequest. The browser navigates all redirects before returning a result, so there is no opportunity to interrupt the redirect flow.—XMLHttpRequest specification