var request = require('../index')
tape('bind to invalid address', function (t) {
uri: 'http://www.google.com',
t.equal(true, /bind EADDRNOTAVAIL/.test(err.message))
tape('bind to local address', function (t) {
uri: 'http://www.google.com',
localAddress: '127.0.0.1'
tape('bind to local address on redirect', function (t) {
var localInterfaces = os.networkInterfaces()
Object.keys(localInterfaces).forEach(function (ifname) {
localInterfaces[ifname].forEach(function (iface) {
if (iface.family !== 'IPv4' || iface.internal !== false) {
localIPS.push(iface.address)
uri: 'http://google.com',
localAddress: localIPS[0]
t.equal(res.request.localAddress, localIPS[0])