new Request(params, extendObject)
Request
s are passed to policies when executing them, they have a params method to get parameters
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
params |
Object |
<optional> |
{} | Parameters / data of this 'request' |
extendObject |
Object |
<optional> |
{} | Object with which the Request instance should be extended |
Example
const req = Request({attr: 'val1'}, {attr2: 'val2'}); req.params.attr === 'val1'; // true req.param('attr') === 'val1'; // true req.attr2 === 'val2'; // true
Methods
-
param(key) → {*}
-
Gets a property from the params object by key.
Parameters:
Name Type Description key
String Key of the param to get Returns:
- Type
- *