bkrem / express-lowercase-paths

An Express middleware module that will redirect user HTTP requests that contain uppercase letters, to the same URL converted to lowercase, without modifying query parameters.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Very similar to the unmaintained project express-uncapitalize, this middleware redirects any requests which contain uppercase chars to their lowercase forms. With two main changes from the original:

  1. Works with all utf-8 strings in paths
  2. Keeps query parameters intact

Installation

npm install express-lowercase-paths-with-status-code

Usage

var lowercasePaths = require("express-lowercase-paths-with-status-code")
app.use(lowercasePaths())

Options

Redirecting with specific status code

To redirect with a specific status code, pass the redirectStatusCode option to the middleware:

var lowercasePaths = require("express-lowercase-paths-with-status-code")
app.use(lowercasePaths({redirectStatusCode: 301}))

About

An Express middleware module that will redirect user HTTP requests that contain uppercase letters, to the same URL converted to lowercase, without modifying query parameters.


Languages

Language:JavaScript 100.0%