Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'url' property not on response #235

Closed
rightaway opened this issue Oct 25, 2016 · 5 comments
Closed

'url' property not on response #235

rightaway opened this issue Oct 25, 2016 · 5 comments

Comments

@rightaway
Copy link

rightaway commented Oct 25, 2016

response.url is undefined. To get the url after redirects I need to use response.socket._httpMessage.res.url.

  return got(url)
    .then(async (response) => {
      console.log(response.requestUrl)
      console.log(response.url)
      console.log(response.socket._httpMessage.res.url)
    })

Using version 6.5.0.

@sindresorhus
Copy link
Owner

Would you mind submitting a failing test? That would make it a lot easier for us to fix the problem ;)

@kevva
Copy link
Contributor

kevva commented Oct 26, 2016

We only set url when there are redirects. Maybe we should stay consistent and always add it @sindresorhus @floatdrop?

@floatdrop
Copy link
Contributor

@kevva I think #230 covers this case, it just not released yet.

@kevva
Copy link
Contributor

kevva commented Oct 26, 2016

@floatdrop, nah, that's only requestUrl. He want the final URL that we set here. It's not that useful when there aren't any redirects but API-wise I think it's better to be consistent anyway.

@sindresorhus
Copy link
Owner

Agreed

kevva added a commit that referenced this issue Oct 26, 2016
floatdrop pushed a commit that referenced this issue Oct 27, 2016
* Add `url` to response

Fixes #235.
floatdrop pushed a commit that referenced this issue Nov 1, 2016
* Add `url` to response

Fixes #235.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants