Skip to content
Snippets Groups Projects
Commit 7a677b68 authored by Francé Wilke's avatar Francé Wilke
Browse files

Update const name

parent 2d20d667
Branches
Tags v1.168.0
No related merge requests found
......@@ -15,7 +15,7 @@ import (
"github.com/aws/aws-lambda-go/lambdacontext"
)
const HTTPXRequestIDHeaderValue = "X-Request-ID"
const HTTPXRequestIDHeaderKey = "X-Request-ID"
func RequestIDFromLambdaContext(ctx context.Context) *string {
// Get request ID from context
......@@ -39,14 +39,14 @@ func RequestIDFromHeaders(headers map[string]string, requestIDHeaderKey string)
func AddRequestIDToHeaders(requestID *string, responseHeaders map[string]string, requestIDHeaderKey string, requestHeaders map[string]string) {
if requestID != nil && responseHeaders != nil {
responseHeaders[requestIDHeaderKey] = *requestID
responseHeaders[HTTPXRequestIDHeaderValue] = *requestID
responseHeaders[HTTPXRequestIDHeaderKey] = *requestID
}
// Add the HTTP X-Request-ID request header to the response headers: https://http.dev/x-request-id
for key, val := range requestHeaders {
// Don't be case-sensitive
if strings.ToLower(key) == strings.ToLower(HTTPXRequestIDHeaderValue) {
responseHeaders[HTTPXRequestIDHeaderValue] = val
if strings.ToLower(key) == strings.ToLower(HTTPXRequestIDHeaderKey) {
responseHeaders[HTTPXRequestIDHeaderKey] = val
break
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment