Constructor
new RouterRequest(cfReqObj)
Name | Type | Description |
---|---|---|
cfReqObj | CloudFrontRequest | CloudFront request object. |
- Source
Methods
body() → {String}
Return the base64-encoded body data.
- Source
- Type:
- String
clientIp() → {String}
Return the HTTP client IP (remote address).
- Source
- Type:
- String
data() → {CloudFrontRequest}
Return CloudFront request object.
- Source
- Type:
- CloudFrontRequest
getHeaders() → {CloudFrontFunctionsHeaders}
Return the headers of the request.
- Source
- Type:
- CloudFrontFunctionsHeaders
header(name) → {String|undefined}
Return value for given HTTP header name.
Name | Type | Description |
---|---|---|
name | String | HTTP header name. |
- Source
- Type:
- String |
undefined
const value = req.header('Content-Type');
// text/html
is(mimeType) → {Boolean}
Check Accept matches the given value.
Name | Type | Description |
---|---|---|
mimeType | String | MIME type value. |
- Source
- Type:
- Boolean
const value = req.is('text/html');
// true
method() → {String}
Return the HTTP method of the request.
- Source
- Type:
- String
param(name) → {String|Object|undefined}
Return the HTTP request parameters or name/value.
Name | Type | Description |
---|---|---|
name | String | Parameter name (optional). |
- Source
- Type:
- String |
Object | undefined
const params = req.param();
// {name: 'value'}
const value = req.param('name');
// value
plugin(name, value) → {*|undefined}
Set/Get value passed down the application stack.
Name | Type | Description |
---|---|---|
name | String | Plugin name. |
value | * | Plugin value. |
- Source
- Type:
- * |
undefined
req.plugin('name', 'value');
..
const value = req.plugin('name');
// value
queryString() → {String}
Return the serialized query parameters.
- Source
- Type:
- String
uri() → {String}
Return the relative path of the requested object.
- Source
- Type:
- String
(static) isJson(str) → {Boolean}
Check valid JSON string format.
Name | Type | Description |
---|---|---|
str | String | JSON string. |
- Source
- Type:
- Boolean
(static) isParams(str) → {Boolean}
Check valid HTTP request parameters.
Name | Type | Description |
---|---|---|
str | String | Parameter name/value pairs. |
- Source
- Type:
- Boolean
(static) parseBody(str) → {Object|undefined}
Convert base64-encoded request body to object.
Name | Type | Description |
---|---|---|
str | String | base64 string. |
- Source
- Type:
- Object |
undefined
(static) parseParams(str) → {Object}
Convert serialized query string to object.
Name | Type | Description |
---|---|---|
str | String | Parameter name/value pairs. |
- Source
- Type:
- Object