INNER CODE UNIT · JavaScript

customBinaryCheck

fastify/aws-lambda-fastify · index.js:10

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
  }
  return (_event) => false
}

module.exports = (app, options) => {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…