/middleware/validateRequestParams
Methods
(inner) validateRequestParams(req) → {Object}
The method assigns a params object from the request params and query objects.
The restricted params.user will be deleted. The params.user can only be assigned from a user object returned from the user/auth module.
The method will return an error if some params key contains non whitelisted character or if the restricted user param is detected.
The template param will be set from _template if not explicit. This is required for the vercel router logic which does not allow to use URL path parameter to have the same key as request parameter.
The params object will have a language property which is set to en if not explicit.
The params object properties will be iterated through to parse Object values [eg null, boolean, array], and remove undefined parameter properties.
| Name | Type | Description |
|---|---|---|
req | req | HTTP request. |
| Name | Type | Description |
|---|---|---|
req.params | Object | The request params object. |
req.query | Object | The request query object. |
Returns a validated params object.
- Type:
- Object