{"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,"search_vec":"'-2018':32 '0.5.1':23 'altern':45 'approach':40 'array':37 'array-bas':36 'base':38 'cadenc':27 'case':17,51,59,72 'case-insensit':16 'coercion':63 'current':19 'default':65 'depend':42 'differenti':34 'express':1,6,50,68 'express-case-sensit':49 'footprint':44 'handl':58 'incom':10 'insensit':18 'javascript':67 'key':33 'last':28 'librari':47 'like':30,48 'low':25 'manual':54 'middlewar':5,7,69 'name':13 'normal':2,9,55,60 'note':56 'param':4,71 'paramet':12 'pre':31 'queri':3,11,70 'releas':26 'sensit':52,73 'simpl':35 'small':43 'stabl':20 'type':62 'updat':29 'valu':66 'version':21 'whitelist':39","created_at":"2026-04-25T07:37:44.924582+00:00","updated_at":"2026-04-25T07:37:44.924582+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/kogosoftwarellc/express-normalize-query-params-middleware","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/express-normalize-query-params-middleware","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}