Skip to content

Commit

Permalink
convert chunk to buffer before pushing to chunks
Browse files Browse the repository at this point in the history
This is because Buffer.concat requires its first argument to be an array of Buffer
Check nodejs/node#4949
  • Loading branch information
shadiakiki1986 committed Nov 18, 2016
1 parent 52cc924 commit 451e66f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rest-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function logResponseBody(req, res, next) {
};

res.end = function (chunk) {
if (chunk) chunks.push(chunk);
if (chunk) chunks.push(Buffer.from(chunk));
var body = Buffer.concat(chunks).toString('utf8');
logger.info(req.path, body);
oldEnd.apply(res, arguments);
Expand Down

0 comments on commit 451e66f

Please sign in to comment.