pixl-server-web
Advanced tools
Comparing version 1.3.26 to 1.3.27
@@ -349,9 +349,11 @@ // Simple HTTP / HTTPS Web Server | ||
// special handling for raw request body | ||
if (data.params.raw && data.params.raw.buffer && data.params.raw.toString) { | ||
if (args.request.headers['content-type'] && args.request.headers['content-type'].match(/(text|javascript|json|xml)/)) { | ||
if (args.request.headers['content-type'] && args.request.headers['content-type'].match(/(text|javascript|json|xml)/) && (data.params.raw.length <= this.logRequestBodyMax)) { | ||
data.params.raw = data.params.raw.toString('utf8'); | ||
} | ||
else data.params.raw = '(Binary Buffer)'; | ||
else data.params.raw = '(Buffer)'; | ||
} | ||
// include details on response as well | ||
data.response = { | ||
@@ -363,2 +365,3 @@ code: args.http_code, | ||
// convert header keys to lower-case | ||
if (args.resp_headers) { | ||
@@ -370,2 +373,3 @@ for (var key in args.resp_headers) { | ||
// special handling for stream and buffer responses | ||
if (args.resp_body && args.resp_body.pipe) { | ||
@@ -375,8 +379,9 @@ data.response.raw = '(Stream)'; | ||
else if (args.resp_body && args.resp_body.buffer && args.resp_body.toString) { | ||
if (data.response.headers && data.response.headers['content-type'] && data.response.headers['content-type'].match(/(text|javascript|json|xml)/)) { | ||
if (data.response.headers && data.response.headers['content-type'] && data.response.headers['content-type'].match(/(text|javascript|json|xml)/) && (args.resp_body.length <= this.logRequestBodyMax)) { | ||
data.response.raw = args.resp_body.toString('utf8'); | ||
} | ||
else data.response.raw = '(Binary Buffer)'; | ||
else data.response.raw = '(Buffer)'; | ||
} | ||
// cleanup | ||
delete args.resp_body; | ||
@@ -383,0 +388,0 @@ delete args.resp_headers; |
{ | ||
"name": "pixl-server-web", | ||
"version": "1.3.26", | ||
"version": "1.3.27", | ||
"description": "A web server component for the pixl-server framework.", | ||
@@ -5,0 +5,0 @@ "author": "Joseph Huckaby <jhuckaby@gmail.com>", |
@@ -51,2 +51,3 @@ // Simple HTTP / HTTPS Web Server | ||
"http_log_request_details": false, | ||
"http_log_body_max": 32768, | ||
"http_log_perf": false, | ||
@@ -108,2 +109,3 @@ "http_perf_threshold_ms": 100, | ||
this.logRequestDetails = this.config.get('http_log_request_details'); | ||
this.logRequestBodyMax = this.config.get('http_log_body_max'); | ||
this.regexLogRequests = this.logRequests ? (new RegExp( this.config.get('http_regex_log') || '.+' )) : null; | ||
@@ -110,0 +112,0 @@ this.logPerfEnabled = this.config.get('http_log_perf'); |
Sorry, the diff of this file is too big to display
246033
3861
1821