Skip to content

Commit 44a7eef

Browse files
Fix spelling and group constants (awslabs#83)
* Fix spelling in error messages * Grouping of const blocks
1 parent a0d9bb9 commit 44a7eef

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

core/request.go

+19-17
Original file line numberDiff line numberDiff line change
@@ -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
}

core/response.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ import (
1212
"github.com/aws/aws-lambda-go/events"
1313
)
1414

15-
const defaultStatusCode = -1
16-
const contentTypeHeaderKey = "Content-Type"
15+
const (
16+
defaultStatusCode = -1
17+
contentTypeHeaderKey = "Content-Type"
18+
)
1719

1820
// ProxyResponseWriter implements http.ResponseWriter and adds the method
1921
// necessary to return an events.APIGatewayProxyResponse object

0 commit comments

Comments
 (0)