greim/hoxy

Rename "url" APIs to "path".

Opened this issue · 6 comments

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".

Is path really a better term since it contains the protocol and domain as
well?
On 5 Nov 2015 19:35, "Seth Holladay" notifications@github.com 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.

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 commented

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.

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 commented

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.

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