koa-lowercase-path
Koa middleware that converts path to lowercase if not already.
Notice: koa-lowercase-path@2 supports koa@2; if you want to use this module with koa@1, please use koa-lowercase-path@1.
Installation
npm install koa-lowercase-path
API
const Koa = ;const app = ;app;
opts
options object.
Options
defer
- If true, serves after yield next, allowing any downstream middleware to respond first.chained
- If the middleware should continue modifying the url if it detects that a redirect already have been performed. Defaults totrue
.
Example
const Koa = ;const lowercasePath = ; const app = ; app; app; app;
Important
Make sure this is added before an eventual koa-static middleware to make sure requests to files are not changed and managed correctly. This because it will not rewrite the URL if a body
has been set along with status 200
.
If all paths always should be rewritten one can set defer
to false
.
License
MIT