INNER CODE UNIT · JavaScript
isCompressedDefault
fastify/aws-lambda-fastify · index.js:5
const isCompressedDefault = (res) => {
const contentEncoding = res.headers['content-encoding'] || res.headers['Content-Encoding']
return contentEncoding && contentEncoding !== 'identity'
}
const customBinaryCheck = (options, res) => {
const enforceBase64 = typeof options.enforceBase64 === 'function' ? options.enforceBase64 : isCompressedDefault
return enforceBase64(res) === true
}
// Header names reserved for this library's own internal protocol.
// They are always stripped from the incoming event so a client can never forge them.
const TOKEN_HEADER = 'x-aws-lambda-fastify-request'
const RESERVED_HEADERS = [TOKEN_HEADER, 'x-apigateway-event', 'x-apigateway-context']
const disableBase64EncodingDefault = (options) => {
if (options.payloadAsStream) {
return (event) => !event.requestContext?.elb