Skip to content

Commit d9ba044

Browse files
committed
Add hostname + url test case
1 parent 9a87002 commit d9ba044

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

test/basic.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,26 @@ test('rewrite POST redirects to GET', function (t) {
170170
})
171171
})
172172
})
173+
174+
test('simple get hostname + url', function (t) {
175+
t.plan(5)
176+
177+
const server = http.createServer(function (req, res) {
178+
t.equal(req.url, '/path')
179+
res.statusCode = 200
180+
res.end('response')
181+
})
182+
183+
server.listen(0, function () {
184+
const port = server.address().port
185+
get({ host: 'localhost', port, url: '/path' }, function (err, res) {
186+
t.error(err)
187+
t.equal(res.statusCode, 200)
188+
concat(res, function (err, data) {
189+
t.error(err)
190+
t.equal(data.toString(), 'response')
191+
server.close()
192+
})
193+
})
194+
})
195+
})

0 commit comments

Comments
 (0)