Browse Source

Add test on GET with bodies

Ensures that https://github.com/tomas/needle/issues/115 will work
http2
Vsevolod Strukchinsky 10 years ago
parent
commit
9fa2c95151
  1. 19
      test/test-post.js

19
test/test-post.js

@ -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);

Loading…
Cancel
Save