Negligent Pachinko Machine

    @lambda-middleware/http-header-normalizer
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.3 • Public • Published

    @lambda-middleware/http-header-normalizer

    npm version downloads open issues debug build status codecov dependency status devDependency status

    Middleware for AWS lambdas that normalizes headers to lower-case and referer to referrer and vice-versa. If you are used to the corresponding middy middleware, please note that this middleware acts differently as it does not hold an exception list and converts everything to lower-case.

    Lambda middleware

    This middleware is part of the lambda middleware series. It can be used independently.

    Usage

    import { httpHeaderNormalizer } from "@lambda-middleware/http-header-normalizer";
    import { APIGatewayProxyEvent, APIGatewayProxyResult } from "aws-lambda";
    
    // This is your AWS handler
    async function helloWorld({
      headers,
    }: APIGatewayProxyEvent): APIGatewayProxyResult {
      return {
        body: JSON.stringify({
          msg: headers["custom-header"],
        }),
        statusCode: 200,
      };
    }
    
    // Wrap the handler with the middleware
    export const handler = httpHeaderNormalizer()(helloWorld);

    Install

    npm i @lambda-middleware/http-header-normalizer

    DownloadsWeekly Downloads

    2

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    11.6 kB

    Total Files

    14

    Last publish

    Collaborators

    • dbartholomae