Skip to content

Commit d3d23a4

Browse files
TMaizeyugasun
authored andcommitted
fix: set isBase64Encoded when content-encoding
1 parent a2223ad commit d3d23a4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ function forwardResponseToApiGateway (server, response, resolver) {
6969
})
7070

7171
const contentType = getContentType({ contentTypeHeader: headers['content-type'] })
72-
const isBase64Encoded = isContentTypeBinaryMimeType({ contentType, binaryMimeTypes: server._binaryTypes })
72+
let isBase64Encoded = isContentTypeBinaryMimeType({ contentType, binaryMimeTypes: server._binaryTypes })
73+
if (['gzip', 'compress', 'deflate', 'br'].indexOf(headers['content-encoding']) !== -1) {
74+
isBase64Encoded = true
75+
}
7376
const body = bodyBuffer.toString(isBase64Encoded ? 'base64' : 'utf8')
7477
const successResponse = {statusCode, body, headers, isBase64Encoded}
7578

0 commit comments

Comments
 (0)