Documentation
¶
Overview ¶
Package apigateway provides a standard serialization format to wrap API Gateway responses that translate into specific end-user errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
Code int `json:"code"`
Err string `json:"err"`
Message string `json:"message"`
Context map[string]interface{} `json:"context,omitempty"`
}
Error represents an error to return in response to an API Gateway request.
func NewErrorResponse ¶
NewErrorResponse returns a response that satisfies the regular expression used to determine integration mappings via the API Gateway. messages is a stringable type. Error interface instances will be properly typecast.
type Response ¶ added in v1.6.0
type Response struct {
Code int `json:"code,omitempty"`
Body interface{} `json:"body,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
}
Response is the type returned by an API Gateway function. Note that a non 2xx HTTP status code should be returned as a Response type rather than an Error. Errors should be reserved for Lambda functions that fail to execute.
func NewResponse ¶ added in v1.6.0
NewResponse returns an API Gateway response object
func (*Response) MarshalJSON ¶ added in v1.6.0
MarshalJSON is a custom marshaller to ensure that the marshalled headers are always lowercase