Pls show the code that is not working? I believe you might have initialised body-parser
the wrong way or there are other issues.
For example, this code below test limit
and it is working by returning a http code 413.
const express = require('express');
const bodyParser = require('body-parser');
const rp = require('request-promise');
const request = require('request');
const app = express();
// change this to 1MB and the test will pass
app.use(bodyParser.json({ limit: '1b' }));
app.post('/', function (req, res) {
res.send('done');
});
//wait for a connection
app.listen(3000, async () => {
console.log('Server started.');
const options = {
url: 'http://localhost:3000/',
method: 'post',
json: true,
body: {
test: '1234567890'
},
resolveWithFullResponse: true
};
rp(options).catch((err) => {
console.log(err);
});
});