lws-request-monitor
Advanced tools
Comparing version 0.1.4 to 0.1.5
12
index.js
@@ -18,3 +18,7 @@ module.exports = MiddlewareBase => class RequestMonitor extends MiddlewareBase { | ||
if (ctx.request.rawBody) { | ||
reqInfo.body = ctx.request.body | ||
if (Object.keys(ctx.request.body).length) { | ||
reqInfo.body = ctx.request.body | ||
} else { | ||
reqInfo.body = ctx.request.rawBody | ||
} | ||
} else { | ||
@@ -39,2 +43,8 @@ const incomingBuffer = ctx.req._readableState.buffer | ||
if (ctx.response.is('json')) { | ||
try { | ||
resInfo.body = JSON.parse(resInfo.body) | ||
} catch (err) {} | ||
} | ||
const stream = require('stream') | ||
@@ -41,0 +51,0 @@ if (resInfo.body instanceof stream.Readable) { |
{ | ||
"name": "lws-request-monitor", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Verbose request logging middleware for lws", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/lwsjs/request-monitor.git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22334
83