You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,37 @@ req: {
93
93
94
94
Checking `req.body` may be turned off by using `app.use(hpp({ checkBody: false }))`.
95
95
96
+
## Whitelisting Specific Parameters
97
+
98
+
The `whitelist` option allows to specify parameters that shall not be touched by HPP. Usually specific parameters of a certain route are intentionally used as arrays. For that use the following approach that involves multiple HPP middlewares:
99
+
100
+
```js
101
+
// Secure all routes at first.
102
+
// You could add separate HPP middlewares to each route individually but the day will come when you forget to secure a new route.
103
+
app.use(hpp());
104
+
105
+
// Add a second HPP middleware to apply the whitelist only to this route.
0 commit comments