|
@ -9,6 +9,11 @@ s.on('/', function (req, res) { |
|
|
req.pipe(res); |
|
|
req.pipe(res); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
s.on('/method', function (req, res) { |
|
|
|
|
|
res.setHeader('method', req.method); |
|
|
|
|
|
res.end(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
s.on('/empty', function (req, res) { |
|
|
s.on('/empty', function (req, res) { |
|
|
res.end(); |
|
|
res.end(); |
|
|
}); |
|
|
}); |
|
@ -19,6 +24,20 @@ tape('setup', function (t) { |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
tape('GET can have body', function (t) { |
|
|
|
|
|
t.plan(3); |
|
|
|
|
|
|
|
|
|
|
|
var stream = from(['wow']); |
|
|
|
|
|
stream.on('end', function () { |
|
|
|
|
|
t.ok(true); // Ensure, that stream was dumped
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
got.get(s.url + '/method', {body: stream}, function (err, data, res) { |
|
|
|
|
|
t.error(err); |
|
|
|
|
|
t.equal(res.headers.method, 'GET'); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
tape('send data from options with post request', function (t) { |
|
|
tape('send data from options with post request', function (t) { |
|
|
t.plan(3); |
|
|
t.plan(3); |
|
|
|
|
|
|
|
|