@@ -19,21 +19,23 @@ import (
1919 "github.com/aws/aws-lambda-go/lambdacontext"
2020)
2121
22- // CustomHostVariable is the name of the environment variable that contains
23- // the custom hostname for the request. If this variable is not set the framework
24- // reverts to `RequestContext.DomainName`. The value for a custom host should
25- // include a protocol: http://my-custom.host.com
26- const CustomHostVariable = "GO_API_HOST"
27-
28- // APIGwContextHeader is the custom header key used to store the
29- // API Gateway context. To access the Context properties use the
30- // GetAPIGatewayContext method of the RequestAccessor object.
31- const APIGwContextHeader = "X-GoLambdaProxy-ApiGw-Context"
32-
33- // APIGwStageVarsHeader is the custom header key used to store the
34- // API Gateway stage variables. To access the stage variable values
35- // use the GetAPIGatewayStageVars method of the RequestAccessor object.
36- const APIGwStageVarsHeader = "X-GoLambdaProxy-ApiGw-StageVars"
22+ const (
23+ // CustomHostVariable is the name of the environment variable that contains
24+ // the custom hostname for the request. If this variable is not set the framework
25+ // reverts to `RequestContext.DomainName`. The value for a custom host should
26+ // include a protocol: http://my-custom.host.com
27+ CustomHostVariable = "GO_API_HOST"
28+
29+ // APIGwContextHeader is the custom header key used to store the
30+ // API Gateway context. To access the Context properties use the
31+ // GetAPIGatewayContext method of the RequestAccessor object.
32+ APIGwContextHeader = "X-GoLambdaProxy-ApiGw-Context"
33+
34+ // APIGwStageVarsHeader is the custom header key used to store the
35+ // API Gateway stage variables. To access the stage variable values
36+ // use the GetAPIGatewayStageVars method of the RequestAccessor object.
37+ APIGwStageVarsHeader = "X-GoLambdaProxy-ApiGw-StageVars"
38+ )
3739
3840// RequestAccessor objects give access to custom API Gateway properties
3941// in the request.
@@ -52,7 +54,7 @@ func (r *RequestAccessor) GetAPIGatewayContext(req *http.Request) (events.APIGat
5254 context := events.APIGatewayProxyRequestContext {}
5355 err := json .Unmarshal ([]byte (req .Header .Get (APIGwContextHeader )), & context )
5456 if err != nil {
55- log .Println ("Erorr while unmarshalling context" )
57+ log .Println ("Error while unmarshalling context" )
5658 log .Println (err )
5759 return events.APIGatewayProxyRequestContext {}, err
5860 }
@@ -70,7 +72,7 @@ func (r *RequestAccessor) GetAPIGatewayStageVars(req *http.Request) (map[string]
7072 }
7173 err := json .Unmarshal ([]byte (req .Header .Get (APIGwStageVarsHeader )), & stageVars )
7274 if err != nil {
73- log .Println ("Erorr while unmarshalling stage variables" )
75+ log .Println ("Error while unmarshalling stage variables" )
7476 log .Println (err )
7577 return stageVars , err
7678 }
0 commit comments