Urlencode path parser middleware for the middy framework

Downloads in past


3,04163.5.021 hours ago3 years agoMinified + gzip package size for @middy/http-urlencode-path-parser in KB


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

<img src="https://badge.fury.io/js/%40middy%2Fhttp-urlencode-path-parser.svg" alt="npm version" style="max-width:100%;">
<img src="https://packagephobia.com/badge?p=@middy/http-urlencode-path-parser" alt="npm install size" style="max-width:100%;">
<img src="https://github.com/middyjs/middy/actions/workflows/tests.yml/badge.svg?branch=main&event=push" alt="GitHub Actions CI status badge" style="max-width:100%;">

<a href="https://standardjs.com/">
 <img src="https://img.shields.io/badge/code_style-standard-brightgreen.svg" alt="Standard Code Style"  style="max-width:100%;">
<img src="https://snyk.io/test/github/middyjs/middy/badge.svg" alt="Known Vulnerabilities" data-canonical-src="https://snyk.io/test/github/middyjs/middy" style="max-width:100%;">
<img src="https://img.shields.io/lgtm/grade/javascript/g/middyjs/middy.svg?logo=lgtm&logoWidth=18" alt="Language grade: JavaScript" style="max-width:100%;">
<img src="https://bestpractices.coreinfrastructure.org/projects/5280/badge" alt="Core Infrastructure Initiative (CII) Best Practices"  style="max-width:100%;">

<img src="https://badges.gitter.im/gitterHQ/gitter.svg" alt="Chat on Gitter" style="max-width:100%;">
<img src="https://img.shields.io/badge/StackOverflow-[middy]-yellow" alt="Ask questions on StackOverflow" style="max-width:100%;">

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.


To install this middleware you can use NPM:
npm install --save @middy/http-urlencode-path-parser



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


// 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.


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


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