mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
549 B
21 lines
549 B
12 years ago
|
var request = require('../index')
|
||
|
, http = require('http')
|
||
|
, assert = require('assert')
|
||
|
;
|
||
|
|
||
|
var s = http.createServer(function (req, resp) {
|
||
|
resp.statusCode = 200
|
||
|
resp.end('')
|
||
|
}).listen(8080, function () {
|
||
|
var r = request('http://localhost:8080', function (e, resp, body) {
|
||
|
assert.equal(resp.statusCode, 200)
|
||
|
assert.equal(body, "")
|
||
|
|
||
|
var r2 = request({ url: 'http://localhost:8080', json: {} }, function (e, resp, body) {
|
||
|
assert.equal(resp.statusCode, 200)
|
||
|
assert.equal(body, undefined)
|
||
|
s.close()
|
||
|
});
|
||
|
})
|
||
|
})
|