Notwithstanding Precautions, Misadventure

    @middy/http-urlencode-path-parser
    TypeScript icon, indicating that this package has built-in type declarations

    3.0.3 • Public • Published

    Middy http-urlencode-body-parser middleware

    Middy logo

    HTTP URLencode body parser middleware for the middy framework, the stylish Node.js middleware engine for AWS Lambda

    npm version npm install size GitHub Actions CI status badge
    Standard Code Style Known Vulnerabilities Language grade: JavaScript Core Infrastructure Initiative (CII) Best Practices
    Chat on Gitter Ask questions on StackOverflow

    You can read the documentation at: https://middy.js.org/docs/middlewares/http-urlencode-path-parser

    This middleware automatically parses HTTP requests with URL-encoded paths. This can happen when using path variables (ie /{name}/) for an endpoint and the UI encodeURIComponent the values before making the request.

    Install

    To install this middleware you can use NPM:

    npm install --save @middy/http-urlencode-path-parser

    Options

    None

    Sample usage

    import middy from '@middy/core'
    import httpUrlEncodePathParser from '@middy/http-urlencode-path-parser'
    
    const handler = middy((event, context) => {
      return event.body // propagates the body as response
    })
    
    handler.use(httpUrlEncodePathParser())
    
    // When Lambda runs the handler with a sample event...
    const event = {
    
      pathParameters: {
        name: encodeURIComponent('Mîddy')
      }
    }
    
    handler(event, {}, (_, body) => {
      t.deepEqual(body, {
        name: 'Mîddy'
      })
    })

    Middy documentation and examples

    For more documentation and examples, refers to the main Middy monorepo on GitHub or Middy official website.

    Contributing

    Everyone is very welcome to contribute to this repository. Feel free to raise issues or to submit Pull Requests.

    License

    Licensed under MIT License. Copyright (c) 2017-2022 Luciano Mammino, will Farrell, and the Middy team.

    FOSSA Status

    Install

    npm i @middy/http-urlencode-path-parser

    Homepage

    middy.js.org

    DownloadsWeekly Downloads

    5,237

    Version

    3.0.3

    License

    MIT

    Unpacked Size

    7.94 kB

    Total Files

    6

    Last publish

    Collaborators

    • lmammino
    • middyjs
    • willfarrell