- From: Artem Skoretskiy <notifications@github.com>
- Date: Thu, 14 Jun 2018 02:35:16 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/issues/763@github.com>
When you use redirect="manual" there is not way to get the new URL, i.e. to where response was redirected. Example for Firefox: ``` fetch("/account/", { credentials: 'same-origin', redirect: 'manual', }).then(response => { console.log(response); }); ``` Server would response with redirect to `/login/?next=/account/`. Here is Javascript Response object: ``` { bodyUsed: false, headers: {}, ok: false, redirected: false, status: 0, statusText: "", type: "opaqueredirect", url: "http://localhost:8000/account/" } ``` So response.url is the URL I requested. How could I get the URL where response was redirected to? There is no "redirect_url" and headers are empty. As far as I understand the specification, with "manual" is meant to handle redirects manually. Then there should be a way to get this new URL and do another request to this new URL. Here is what server send: ``` HTTP/1.1 302 Found X-Powered-By: Express date: Thu, 14 Jun 2018 09:41:49 GMT server: WSGIServer/0.2 CPython/3.7.0b5 content-type: text/html; charset=utf-8 location: /login/?next=/account/ x-frame-options: SAMEORIGIN content-length: 0 vary: Accept-Language, Cookie content-language: en connection: keep-alive ``` How to access this new url `/login/?next=/account/`? -- 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/763
Received on Thursday, 14 June 2018 09:35:39 UTC