question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[question] how to get current location after some 302 redirects

See original GitHub issue

I find the url in response.request._currentUrl after print the hole response. but I wonder if there is a clean and nice way to get it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

62reactions
syzercommented, May 9, 2018

👍

3reactions
kevinsimpercommented, Feb 27, 2018

I ended up not using the responseUrl, but instead disabled redirect and just used the header location.

return axios
        .get(URL, {
          maxRedirects: 0,
          validateStatus: null
        })
        .then(res => {
          expect(
            res.headers.location,
            'to be',
            '/'
          )
        })
Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting the location from a WebClient on a HTTP 302 Redirect?
The HttpWebRequest has a property AllowAutoRedirect which you can set to false (it is always true for WebClient ), and then get the...
Read more >
How To Fix the HTTP 302 Error (5 Methods) - Kinsta
HTTP 302 codes are useful to temporarily redirect website users to another URL. If you're getting this error code, here are 5 ways...
Read more >
302 Found - HTTP - MDN Web Docs
The HyperText Transfer Protocol (HTTP) 302 Found redirect status response code indicates that the resource requested has been temporarily ...
Read more >
Redirects and Google Search | Documentation
Redirecting URLs is the practice of resolving an existing URL to a different one, effectively telling your visitors and Google Search that a...
Read more >
302 response code isn't causing redirect
The Location header does not exist and therefore there is no redirection to any location. the URL pointed towards is the exact same....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found