1
0
Fork 0

don't fail if body response is undefined

This commit is contained in:
Jan Steemann 2014-02-01 12:08:08 +01:00
parent 4a99cde395
commit d9bc39c576
1 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/*jslint indent: 2, nomen: true, maxlen: 120 */ /*jslint indent: 2, nomen: true, maxlen: 120, vars: true */
/*global module, require, exports */ /*global module, require, exports */
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -209,11 +209,15 @@ BaseMiddleware = function () {
if (trace) { if (trace) {
if (response.hasOwnProperty("body")) { if (response.hasOwnProperty("body")) {
var bodyLength = 0;
if (response.body !== undefined) {
bodyLength = parseInt(response.body.length, 10);
}
console.log("%s, outgoing response with status %s of type %s, body length: %d", console.log("%s, outgoing response with status %s of type %s, body length: %d",
options.mount, options.mount,
response.responseCode, response.responseCode,
response.contentType, response.contentType,
parseInt(response.body.length, 10)); bodyLength);
} else if (response.hasOwnProperty("bodyFromFile")) { } else if (response.hasOwnProperty("bodyFromFile")) {
console.log("%s, outgoing response with status %s of type %s, body file: %s", console.log("%s, outgoing response with status %s of type %s, body file: %s",
options.mount, options.mount,