ethanent / phin

Node HTTP client
MIT License
576 stars 33 forks source link

Setting local address? #9

Closed yaneony closed 7 years ago

yaneony commented 7 years ago

Is setting local address possible with this library?

bdsomer commented 7 years ago

@jsieler Could you please elaborate?

yaneony commented 7 years ago

@bdsomer as for example copied from "request" module:

localAddress - local interface to bind for network connections.

Also, if your server do have multiple IP adresses, this option allows you to set interface address for desired connection.

ethanent commented 7 years ago

I'll be sure to implement this in a near release. 👍 Thanks for the suggestion!

bdsomer commented 7 years ago

@jsieler @ethanent Already exists, implemented as the localAddress property. See the documentation of the options paramater here.

ethanent commented 7 years ago

@bdsomer We've been discussing phin, not the Node HTTP module. This feature does not exist in phin.

bdsomer commented 7 years ago

@ethanent Yes it does! Object.assign causes all options passed in to be forwarded to the HTTP module. Go ahead, try it yourself!

ethanent commented 7 years ago

@bdsomer Oh, ha. Didn't realize we did that with the opts object. Thanks for reminding me!

@jsieler You should be good to go! Just add the localAddress property to the phin request options!