Skip to content

Commit 6995411

Browse files
authored
Merge pull request #28 from jkyberneees/exclude-buffer-from-json
Exclude buffer from application/json parsing
2 parents 93386f9 + c3d9209 commit 6995411

File tree

4 files changed

+536
-740
lines changed

4 files changed

+536
-740
lines changed

libs/response-extensions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module.exports.send = (options, req, res) => (data = 200, code = 200, headers =
4040
}
4141
if (options.disableResponseEvent !== true) { res.emit('response', params) }
4242

43-
if (typeof data === 'object') {
43+
if (typeof data === 'object' && data instanceof Buffer === false) {
4444
// transparently setting the 'content-type' header if JSON
4545
res.setHeader('content-type', 'application/json')
4646
params.data = JSON.stringify(params.data)

0 commit comments

Comments
 (0)