Skip to content

Commit

Permalink
Merge pull request #28 from jkyberneees/exclude-buffer-from-json
Browse files Browse the repository at this point in the history
Exclude buffer from application/json parsing
  • Loading branch information
jkyberneees authored Apr 4, 2019
2 parents 93386f9 + c3d9209 commit 6995411
Show file tree
Hide file tree
Showing 4 changed files with 536 additions and 740 deletions.
2 changes: 1 addition & 1 deletion libs/response-extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports.send = (options, req, res) => (data = 200, code = 200, headers =
}
if (options.disableResponseEvent !== true) { res.emit('response', params) }

if (typeof data === 'object') {
if (typeof data === 'object' && data instanceof Buffer === false) {
// transparently setting the 'content-type' header if JSON
res.setHeader('content-type', 'application/json')
params.data = JSON.stringify(params.data)
Expand Down
Loading

0 comments on commit 6995411

Please sign in to comment.