Browse Source

Test if opts.bodyParser is false body parsing middleware is disabled

pull/32/head
Luke Childs 6 years ago
parent
commit
43417e2251
  1. 15
      test/create-test-server.js

15
test/create-test-server.js

@ -186,6 +186,21 @@ test('opts.bodyParser is passed through to bodyParser', async t => {
}));
});
test('if opts.bodyParser is false body parsing middleware is disabled', async t => {
const server = await createTestServer({ bodyParser: false });
const text = 'foo';
server.post('/echo', (req, res) => {
t.deepEqual(req.body, undefined);
res.end();
});
await got.post(server.url + '/echo', {
headers: { 'content-type': 'text/plain' },
body: text
});
});
test('support returning body directly', async t => {
const server = await createTestServer();

Loading…
Cancel
Save