We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 614d085 commit 4989cd8Copy full SHA for 4989cd8
index.js
@@ -75,7 +75,16 @@ module.exports = (
75
************************************/
76
if (!config.app.disableLogRequestBody) {
77
app.addHook('preHandler', (req, res, done) => {
78
- if (req.body) req.log.info(req.body);
+ let clone = null;
79
+ if (req.body && req.headers['content-length'] > 1000) {
80
+ clone = JSON.parse(JSON.stringify(req.body));
81
+ for (const key in clone) {
82
+ if (clone[key] && clone[key].length > 100) {
83
+ clone[key] = clone[key].slice(0, 100) + '...';
84
+ }
85
86
87
+ req.log.info({url: req.url, body: clone || req.body, headers: req.headers});
88
done()
89
})
90
}
0 commit comments