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

Add url property to got.stream() request and response objects #229

Closed
stevenvachon opened this issue Oct 16, 2016 · 2 comments
Closed

Add url property to got.stream() request and response objects #229

stevenvachon opened this issue Oct 16, 2016 · 2 comments
Labels
enhancement This change will extend Got features ✭ help wanted ✭

Comments

@stevenvachon
Copy link
Contributor

stevenvachon commented Oct 16, 2016

require("got").stream("http://google.com/")
.on("request", request => console.log(request))
.on("response", response => console.log(response));

Pretty well every other http request library provides a url property in these objects. Why doesn't this one?

@stevenvachon
Copy link
Contributor Author

stevenvachon commented Oct 16, 2016

The URLs that are included (in some redirects), also appear to be adding default ports in:

// redirect.html -> (302) redirect2.html -> (301) redirected.html
require("got").stream("http://domain/redirect.html")
.on("redirect", response => console.log(response.url));

logs "" and "http://domain:80/redirected.html"

@sindresorhus
Copy link
Owner

👍 We already do this for normal got usage (1409f82), but I think we forgot about the stream case.

Interested in doing a pull request? :)

@sindresorhus sindresorhus changed the title no request or response url Add url property to got.stream() request and response objects Oct 17, 2016
@sindresorhus sindresorhus added enhancement This change will extend Got features ✭ help wanted ✭ labels Oct 17, 2016
kevva added a commit that referenced this issue Oct 19, 2016
floatdrop pushed a commit that referenced this issue Oct 20, 2016
* Add `requestUrl` to response in streaming mode (Fixes #229).
* Set `requestUrl` inside `requestAsEventEmitter()`
floatdrop pushed a commit that referenced this issue Nov 1, 2016
* Add `requestUrl` to response in streaming mode (Fixes #229).
* Set `requestUrl` inside `requestAsEventEmitter()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This change will extend Got features ✭ help wanted ✭
Projects
None yet
Development

No branches or pull requests

2 participants