Browse Source

Update test.

pull/22/head
wtgtybhertgeghgtwtg 7 years ago
parent
commit
cef697088f
  1. 21
      test/create-test-server.js

21
test/create-test-server.js

@ -154,16 +154,29 @@ test('opts.certificate is passed through to createCert()', async t => {
});
test('opts.bodyParser is passed through to bodyParser', async t => {
const server = await createTestServer({ bodyParser: { limit: '200kb' } });
const smallServer = await createTestServer({ bodyParser: { limit: '100kb' } });
const bigServer = await createTestServer({ bodyParser: { limit: '200kb' } });
server.post('/echo', (req, res) => {
smallServer.post('/echo', (req, res) => {
t.pass(req.body.size > 100 * 1024);
res.end();
});
await got.post(server.url + '/echo', {
bigServer.post('/echo', (req, res) => {
t.pass(req.body.size > 100 * 1024);
res.end();
});
const buf = Buffer.alloc(150 * 1024);
await t.throws(got.post(smallServer.url + '/echo', {
headers: { 'content-type': 'application/octet-stream' },
body: buf
}));
await got.post(bigServer.url + '/echo', {
headers: { 'content-type': 'application/octet-stream' },
body: Buffer.alloc(101 * 1024)
body: buf
});
});

Loading…
Cancel
Save