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

Rename "url" APIs to "path". #66

Open
sholladay opened this issue Nov 5, 2015 · 6 comments
Open

Rename "url" APIs to "path". #66

sholladay opened this issue Nov 5, 2015 · 6 comments

Comments

@sholladay
Copy link
Contributor

Having url and fullUrl is an odd concept to me. It seems like a wart in Hoxy's otherwise excellent semantics. I find myself explaining it in code comments.

Would you be open to renaming the usages of "url" to "path" where that is what it really means?

As a stretch goal, "fullUrl" could then become "url".

@editedredx
Copy link

Is path really a better term since it contains the protocol and domain as
well?
On 5 Nov 2015 19:35, "Seth Holladay" [email protected] wrote:

Having url http://greim.github.io/hoxy/#request-url and fullUrl
http://greim.github.io/hoxy/#request-fullUrl is an odd concept to me.
It seems like a wart in Hoxy's otherwise excellent semantics. I find myself
explaining it in code comments.

Would you be open to renaming the usages of "url" to "path" where that is
what it really means?

As a stretch goal, "fullUrl" could then become "url".


Reply to this email directly or view it on GitHub
#66.

@sholladay
Copy link
Contributor Author

Aha! See, it is confusing people. No, @editedredx request.url, the intercept 'url' option, etc. are all paths. They do not include the protocol or host. You are thinking of request.fullUrl() and friends.

@greim
Copy link
Owner

greim commented Nov 5, 2015

req.url is root-relative because that's how node http servers (and express) do it. At least that was my thinking at the time :) Maybe when the next major version comes out we could consider renaming these, since it would be a breaking change.

@sholladay
Copy link
Contributor Author

That is fair. Maybe I am barking up the wrong tree. Express gets that from Node's own http module, which has a similar weirdness. When making an http.request() as a client, it calls this path, but when receiving a request message as a server, it calls this url. I am strongly in favor of removing the dissonance between url and fullUrl, in one form or another. It is easy and reasonable to be surprised that url is not "full". That's really the problem I'm trying to solve.

@greim
Copy link
Owner

greim commented Nov 6, 2015

Short of breaking changes, we could alias url => path and refer to that instead in the docs if you think that would help. I'd accept a PR for that.

@sholladay
Copy link
Contributor Author

👍 I'll make a PR sometime this coming week.

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