new Request(event)
Create a new Request object. This is called automatically when a new App is instatiated. You do not need to call this directly.
Parameters:
| Name | Type | Description | 
|---|---|---|
| event | object | AWS Event | 
Members
(readonly) acceptableFileExtensions :string
Only these extensions are considered for a fileExtension
Type:
- string
Example
"example.com/id/1.json" -> "json"(readonly) apiGatewayRouteKey :string
get the route passed in from API Gateway with pathParameters as _.
Type:
- string
Example
"index" or "login" or "/user_userid"(readonly) apiGatewayRouteKeyNoMethod :string
get the route passed in from API Gateway without any substitutions.
Type:
- string
Example
"/user/{userid}"(readonly) body :string|object
AWS API Gateway http body. Returns a string with Post body contents. If request was sent with application/json header, body is automatically JSON parsed and returns an object.
Type:
- string | object
(readonly) cookies :object
AWS API Gateway http cookies
Type:
- object
Example
"foo=bar" -> {"foo": "bar"}(readonly) file :string
Turns types into file routes prepending the AWS type to the requested file.
Type:
- string
Example
"apigateway/index"(readonly) fileExtension :string
If a route ends in .extension this will return 'extension'
Type:
- string
Example
"example.com/id/1.json" -> "json"(readonly) headers :object
AWS API Gateway http headers
Type:
- object
Example
"Content-Type=application/json" -> {"content-type": "application/json"}(readonly) isValidCsrf :boolean
Compares cookie 'csrf' and header 'x-csrf'. If they match it will return true
Type:
- boolean
(readonly) method :string
AWS API Gateway http method
Type:
- string
Example
"GET", "POST"(readonly) pathParameters :object
AWS API Gateway http path parameters
Type:
- object
Example
"example.com/id/1" -> {"id": 1}(readonly) queryStringParameters :object
AWS API Gateway http query string parameters
Type:
- object
Example
"example.com?id=1" -> {"id": 1}(readonly) rawPathNoStage :string
AWS API Gateway raw path remove stage
Type:
- string
Example
"/dev/index" -> "/index"(readonly) stage :string
AWS API Gateway http stage
Type:
- string
Example
"dev", "prod"(readonly) type :string
get the type of AWS event
Type:
- string
Example
'aws:apigateway', 'aws:s3'