Angular2 watch for 302 redirect when fetching resource

前端 未结 2 621
无人共我
无人共我 2020-12-04 01:22

I have a requirement to pull a few resources from another domain held by my company. I want to pull secured HTML content with GET requests.

When a user is signed out

2条回答
  •  自闭症患者
    2020-12-04 02:18

    If the server sends a redirect with a 302 status code with the URL to redirect within a Location header, the redirect is automatically handled by the browser, i.e. a request to this URL is executed.

    That's why XHR (and the Angular2 wrapper around it, i.e. the Http class) won't see the result of the first request but only the response of the second one.

提交回复
热议问题