Discussions » Development

How to trigger XHR redirect (response header + status code)

§
Posted: 27.01.2020.
Edited: 27.01.2020.

How to trigger XHR redirect (response header + status code)

Hello, is there any possibility to trigger HTTP request by any interface when receiving server redirect (HTTP/302(, and have access to response code, response header)? I tried more methods, onstatuschange when readyState==HEADERS_RECEIVED, but it's too late (aleady have final request responses). Afaik, there's not any earlier event that could hold on receiving the primary response. About fetch( { redirect: 'manual' }) it seems to stop at receiving the redirect, but anyway the complete header isnot available (Response.ok == false, Response.headers is empty, Response.status is 0 - not 302)

Post reply

Sign in to post a reply.