(name, redir, expectAuth)
| 67 | handleRequests(ss) |
| 68 | |
| 69 | function runTest (name, redir, expectAuth) { |
| 70 | tape('redirect to ' + name, function (t) { |
| 71 | request(redir.src, function (err, res, body) { |
| 72 | t.equal(err, null) |
| 73 | t.equal(res.request.uri.href, redir.dst) |
| 74 | t.equal(res.statusCode, 200) |
| 75 | t.equal(body, expectAuth |
| 76 | ? 'auth: Basic dGVzdDp0ZXN0aW5n' |
| 77 | : 'auth: (nothing)') |
| 78 | t.end() |
| 79 | }) |
| 80 | }) |
| 81 | } |
| 82 | |
| 83 | function addTests () { |
| 84 | runTest('same host and protocol', |