I would like to add a body property to Express.js\' response object, which will be called every time the send method is called,
I do it by adding the f
You are probably using something like this:
res.send({ foo : 'bar' });
In other words, you're passing an object to res.send.
This will do the following:
res.send with the object as argumentres.send checks the argument type and sees that it's an object, which it passed to res.jsonres.json converts the object to a JSON string, and calls res.send again, but this time with the JSON string as argumentYou have to use res.json(body). It will send "body" as a response body.Make sure body should be object.