|
|
@ -20,6 +20,13 @@ s.on('/endless', function (req, res) { |
|
|
|
res.end(); |
|
|
|
}); |
|
|
|
|
|
|
|
s.on('/relative', function (req, res) { |
|
|
|
res.writeHead(302, { |
|
|
|
location : '/' |
|
|
|
}); |
|
|
|
res.end(); |
|
|
|
}); |
|
|
|
|
|
|
|
s.on('/', function (req, res) { |
|
|
|
res.end('reached'); |
|
|
|
}); |
|
|
@ -38,6 +45,14 @@ tape('follows redirect', function (t) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
tape('follows relative redirect', function (t) { |
|
|
|
got(s.url + '/relative', {agent: false}, function (err, data) { |
|
|
|
t.error(err); |
|
|
|
t.equal(data, 'reached'); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
tape('throws on endless redirect', function (t) { |
|
|
|
got(s.url + '/endless', {agent: false}, function (err) { |
|
|
|
t.ok(err, 'should get error'); |
|
|
|