File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ let httpError = require('./errors')
22let binaryTypes = require ( './helpers/binary-types' )
33let { brotliCompressSync } = require ( 'zlib' )
44
5+ let binaryTypesSet = new Set ( binaryTypes )
6+
57module . exports = function responseFormatter ( req , params ) {
68 let isError = params instanceof Error
79
@@ -167,7 +169,8 @@ module.exports = function responseFormatter (req, params) {
167169 }
168170
169171 // Handle body encoding (if necessary)
170- let isBinary = binaryTypes . some ( t => res . headers [ 'content-type' ] . includes ( t ) )
172+ let [ cTest ] = ( res . headers [ 'content-type' ] || '' ) . split ( ';' )
173+ let isBinary = binaryTypesSet . has ( cTest )
171174 let bodyIsString = typeof res . body === 'string'
172175 let b64enc = i => new Buffer . from ( i ) . toString ( 'base64' )
173176 function compress ( body ) {
You can’t perform that action at this time.
0 commit comments