Skip to content

Commit

Permalink
Add hostname + url test case
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusU committed Feb 6, 2022
1 parent 9a87002 commit d9ba044
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,26 @@ test('rewrite POST redirects to GET', function (t) {
})
})
})

test('simple get hostname + url', function (t) {
t.plan(5)

const server = http.createServer(function (req, res) {
t.equal(req.url, '/path')
res.statusCode = 200
res.end('response')
})

server.listen(0, function () {
const port = server.address().port
get({ host: 'localhost', port, url: '/path' }, function (err, res) {
t.error(err)
t.equal(res.statusCode, 200)
concat(res, function (err, data) {
t.error(err)
t.equal(data.toString(), 'response')
server.close()
})
})
})
})

0 comments on commit d9ba044

Please sign in to comment.