How to use the middy/middlewares.httpHeaderNormalizer function in middy

To help you get started, we’ve selected a few middy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github netlify / cli / src / functions-templates / js / using-middleware / using-middleware.js View on Github external
required: ['result', 'message'],
        properties: {
          result: { type: 'string' },
          message: { type: 'string' }
        }
      }
    },
    required: ['body']
  }
}

/* Export inputSchema & outputSchema for automatic documentation */
exports.schema = schema

exports.handler = middy(businessLogic)
  .use(httpHeaderNormalizer())
  // parses the request body when it's a JSON and converts it to an object
  .use(jsonBodyParser())
  // validates the input
  .use(validator({ inputSchema: schema.input }))
  // handles common http errors and returns proper responses
  .use(httpErrorHandler())
github faultline / faultline / src / handlers / errorsGet.js View on Github external
const handlerBuilder = (aws) => {
    return middy(new ErrorsGetHandler(aws))
        .use(httpHeaderNormalizer())
        .use(checkApiKey())
        .use(httpErrorHandler())
        .use(bodyStringifier())
        .use(cors());
};
const handler = handlerBuilder(aws);
github faultline / faultline / src / handlers / errorsList.js View on Github external
const handlerBuilder = (aws) => {
    return middy(new ErrorsListHandler(aws))
        .use(httpHeaderNormalizer())
        .use(checkApiKey())
        .use(httpErrorHandler())
        .use(bodyStringifier())
        .use(cors());
};
const handler = handlerBuilder(aws);
github faultline / faultline / src / handlers / occurrencesGet.js View on Github external
const handlerBuilder = (aws) => {
    return middy(new OccurrencesGetHandler(aws))
        .use(httpHeaderNormalizer())
        .use(checkApiKey())
        .use(httpErrorHandler())
        .use(bodyStringifier())
        .use(cors());
};
const handler = handlerBuilder(aws);
github faultline / faultline / src / handlers / encrypt.js View on Github external
const handlerBuilder = (aws) => {
    return middy(new EncryptHandler(aws))
        .use(httpHeaderNormalizer())
        .use(checkApiKey())
        .use(checkKmsConfig())
        .use(httpErrorHandler())
        .use(bodyStringifier())
        .use(cors());
};
const handler = handlerBuilder(aws);
github faultline / faultline / src / handlers / occurrencesList.js View on Github external
const handlerBuilder = (aws) => {
    return middy(new OccurrencesListHandler(aws))
        .use(httpHeaderNormalizer())
        .use(checkApiKey())
        .use(httpErrorHandler())
        .use(bodyStringifier())
        .use(cors());
};
const handler = handlerBuilder(aws);
github faultline / faultline / src / handlers / projectsList.js View on Github external
const handlerBuilder = (aws) => {
    return middy(new ProjectsListHandler(aws))
        .use(httpHeaderNormalizer())
        .use(checkApiKey())
        .use(httpErrorHandler())
        .use(bodyStringifier())
        .use(cors());
};
const handler = handlerBuilder(aws);