I send this request with postman.

And I console.log(req.body) returns an array like this:
{ '{"urls":["https://example.com?paramOne': 'foo',
paramTwo: 'bar"]}' }
How can I get the whole body as a simple string like this?
{"urls":["https://example.com?paramOne=foo¶mTwo=bar"]}
In app.js:
Replace:
app.use(express.json());
With:
var rawBodySaver = function (req, res, buf, encoding) {
if (buf && buf.length) {
req.rawBody = buf.toString(encoding || 'utf8');
}
}
app.use(bodyParser.json({ verify: rawBodySaver }));
app.use(bodyParser.urlencoded({ verify: rawBodySaver, extended: true }));
app.use(bodyParser.raw({ verify: rawBodySaver, type: '*/*' }));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With