Middy http-header-normalizer middleware
HTTP header normalizer middleware for the middy framework, the stylish Node.js middleware engine for AWS Lambda
This middleware normalizes HTTP header names to their canonical format. Very useful if clients are
not using the canonical names of header (e.g.
content-type as opposed to
API Gateway does not perform any normalization, so the headers are propagated to Lambda exactly as they were sent by the client.
Other middlewares like
will rely on headers to be in the canonical format, so if you want to support non-normalized headers in your
app you have to use this middleware before those ones.
This middleware will copy the original headers in
To install this middleware you can use NPM:
npm install --save @middy/http-header-normalizer
normalizeHeaderKey(function) (optional): a function that accepts an header name as a parameter and returns its canonical representation.
canonical(bool) (optional): if true, modifies the headers to canonical format, otherwise the headers are normalized to lowercase (default
const middy =const httpHeaderNormalizer =const handler =handler