@@ -19,21 +19,23 @@ import (
19
19
"github.com/aws/aws-lambda-go/lambdacontext"
20
20
)
21
21
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
+ )
37
39
38
40
// RequestAccessor objects give access to custom API Gateway properties
39
41
// in the request.
@@ -52,7 +54,7 @@ func (r *RequestAccessor) GetAPIGatewayContext(req *http.Request) (events.APIGat
52
54
context := events.APIGatewayProxyRequestContext {}
53
55
err := json .Unmarshal ([]byte (req .Header .Get (APIGwContextHeader )), & context )
54
56
if err != nil {
55
- log .Println ("Erorr while unmarshalling context" )
57
+ log .Println ("Error while unmarshalling context" )
56
58
log .Println (err )
57
59
return events.APIGatewayProxyRequestContext {}, err
58
60
}
@@ -70,7 +72,7 @@ func (r *RequestAccessor) GetAPIGatewayStageVars(req *http.Request) (map[string]
70
72
}
71
73
err := json .Unmarshal ([]byte (req .Header .Get (APIGwStageVarsHeader )), & stageVars )
72
74
if err != nil {
73
- log .Println ("Erorr while unmarshalling stage variables" )
75
+ log .Println ("Error while unmarshalling stage variables" )
74
76
log .Println (err )
75
77
return stageVars , err
76
78
}
0 commit comments