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.path vs url.pathname #72

Closed
julien-f opened this issue Jun 19, 2015 · 3 comments
Closed

url.path vs url.pathname #72

julien-f opened this issue Jun 19, 2015 · 3 comments

Comments

@julien-f
Copy link
Contributor

It seems that http(s).request(url) uses url.path while urlLib.format(url) uses url.pathname.

I do not have the time to look further but I think it can cause some issues (for instance when displaying the URL in an error message).

@floatdrop
Copy link
Contributor

@julien-f nice catch. url.format is not quite good at formatting I think:

url.format({protocol: 'http:', host: 'localhost', port: 6767});
// => http://localhost without port

So in error messages (that was generated from got with Object as first argument) we don't have port now. :(

May be it worth trying to replace url.format with some module?

@julien-f
Copy link
Contributor Author

It's because host is ${hostname}:${port}`, therefore it takes precedence.

floatdrop added a commit that referenced this issue Jun 25, 2015
floatdrop added a commit that referenced this issue Jun 25, 2015
floatdrop added a commit that referenced this issue Jun 25, 2015
Parse url at the top of got function and work with request object all the way down.
This reduces complexity and unnecessary delete calls in redirects.

Also this fixes #72.
floatdrop added a commit that referenced this issue Jun 25, 2015
Parse url at the top of got function and work with request object all the way down.
This reduces complexity and unnecessary delete calls in redirects.

Also this fixes #72.
floatdrop added a commit that referenced this issue Jun 25, 2015
@sindresorhus
Copy link
Owner

It seems that http(s).request(url) uses url.path while urlLib.format(url) uses url.pathname.

Should we maybe open an issue on iojs? Seems like that should be consistent.

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

3 participants