Skip to content

Commit

Permalink
Test if opts.bodyParser is false body parsing middleware is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechilds committed Apr 3, 2019
1 parent 04a25a4 commit 43417e2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/create-test-server.js
Expand Up @@ -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();

Expand Down

0 comments on commit 43417e2

Please sign in to comment.