host vs hostname #135

Merged
merged 1 commit into from Dec 15, 2011

Projects

None yet

2 participants

@iangreenleaf

When constructing the options hash to pass to http.request:

self.host = self.uri.hostname

Is there a reason to name it host instead of hostname?

I ran into problems using request with nock, which expects the host value to include the port number, like url.parse' would do.

@mikeal
Member
mikeal commented Dec 15, 2011

sel.uri is return value from url.parse(self.url) if the url is a string.

if you pass a custom object to it you'll need to replicate, exactly, the core API for require('url').parse.

On Dec 14, 2011, at December 14, 20114:58 PM, Ian Young wrote:

When constructing the options hash to pass to http.request:

self.host = self.uri.hostname

Is there a reason to name it host instead of hostname?

I ran into problems using request with nock, which expects the host value to include the port number, like url.parse' would do.


Reply to this email directly or view it on GitHub:
#135

@iangreenleaf

Sorry, I meant the left side. That's the value that eventually gets used by http.request.

@mikeal
Member
mikeal commented Dec 15, 2011

ah, i see

this is probably just legacy logic from the 0.2 days when http.request didn't exist and this property was kept internal.

would love a pull request.

@iangreenleaf

Great! Converted this issue to a pull request.

@mikeal
Member
mikeal commented Dec 15, 2011

do all the tests pass?

@iangreenleaf

Yep! Well, everything except tests/test-cookie.js, which was failing before I made changes, and which I'm guessing isn't related.

@mikeal mikeal merged commit df27368 into request:master Dec 15, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment