{"id":18346,"library":"express-normalize-query-params-middleware","title":"Express Normalize Query Params Middleware","description":"Express middleware that normalizes incoming query parameter names to be case-insensitive. Current stable version is 0.5.1, with low release cadence (last update likely pre-2018). Key differentiator: simple array-based whitelist approach, no dependencies, small footprint. Alternative to libraries like 'express-case-sensitive' or manual normalization. Note: only handles case normalization, not type coercion or default values.","status":"active","version":"0.5.1","language":"javascript","source_language":"en","source_url":"https://github.com/kogosoftwarellc/express-normalize-query-params-middleware","tags":["javascript","express","middleware","query params","case sensitivity"],"install":[{"cmd":"npm install express-normalize-query-params-middleware","lang":"bash","label":"npm"},{"cmd":"yarn add express-normalize-query-params-middleware","lang":"bash","label":"yarn"},{"cmd":"pnpm add express-normalize-query-params-middleware","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM default import recommended. CommonJS require() works but .default may be needed depending on bundler.","wrong":"const normalizeQueryParams = require('express-normalize-query-params-middleware').default","symbol":"default","correct":"import normalizeQueryParams from 'express-normalize-query-params-middleware'"},{"note":"CommonJS require() works directly, no need for .default.","wrong":"","symbol":"default","correct":"const normalizeQueryParams = require('express-normalize-query-params-middleware')"},{"note":"Package does not ship TypeScript definitions; consider using @types/express or custom type declaration.","wrong":"","symbol":"TypeScript types","correct":"import normalizeQueryParams from 'express-normalize-query-params-middleware'"}],"quickstart":{"code":"import normalizeQueryParams from 'express-normalize-query-params-middleware';\nimport express from 'express';\n\nconst app = express();\nconst allowedParams = ['name', 'email', 'age'];\napp.use(normalizeQueryParams(allowedParams));\n\napp.get('/user', (req, res) => {\n  // req.query.name, req.query.email, req.query.age are case-insensitive\n  // e.g., ?Name=John&EMAIL=john@example.com works\n  res.json(req.query);\n});\n\napp.listen(3000);","lang":"javascript","description":"Demonstrates basic usage: normalizes query params to lowercase keys based on whitelist."},"warnings":[{"fix":"Ensure all expected parameters are included in the array passed to normalizeQueryParams.","message":"The middleware only normalizes parameter names listed in the whitelist array; any extra params are left unchanged and case-sensitive.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Always use lowercase strings in the whitelist to avoid confusion.","message":"The whitelist comparison is case-insensitive, but the result sets the key to the lowercase version of the whitelist entry, not the original incoming key. This may cause unexpected key naming if whitelist has mixed case.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Place this middleware early in the stack, before any middleware that depends on normalized query params.","message":"The middleware modifies req.query in place; if other middleware also modifies query, order matters.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use correct import: import normalizeQueryParams from 'express-normalize-query-params-middleware' or const normalizeQueryParams = require('express-normalize-query-params-middleware').default","cause":"Using ES6 import incorrectly with CommonJS require pattern.","error":"TypeError: normalizeQueryParams is not a function"},{"fix":"Run: npm install express-normalize-query-params-middleware","cause":"Package not installed or typo in package name.","error":"Cannot find module 'express-normalize-query-params-middleware'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}