fetch and redirects http 302
interesting learning when using fetch and receiving a redirect response
the browser will automatically follow a 301, 302 redirect from a fetch ajax call by default to the Location in the response header
you can change the fetch redirect property to redirect:'manual' (so you can handle manually) but fetch does not provide a value in response status even tho the http response is 302 (why not?)
redirect:'error' just throws error and there’s no way to check the response status code to know if it's a redicrect or some other kind of error
I think this is a gap in fetch, if handling manually (redirect:'manual') then the status code should be available to check
Comments
Post a Comment