diff --git a/aws/middleware/recursion_detection.go b/aws/middleware/recursion_detection.go index a1a7cf1ea2f..3f6aaf231e1 100644 --- a/aws/middleware/recursion_detection.go +++ b/aws/middleware/recursion_detection.go @@ -9,8 +9,8 @@ import ( ) const envAwsLambdaFunctionName = "AWS_LAMBDA_FUNCTION_NAME" -const envAmznTraceId = "_X_AMZN_TRACE_ID" -const amznTraceIdHeader = "X-Amzn-Trace-Id" +const envAmznTraceID = "_X_AMZN_TRACE_ID" +const amznTraceIDHeader = "X-Amzn-Trace-Id" // AddRecursionDetection adds recursionDetection to the middleware stack func AddRecursionDetection(stack *middleware.Stack) error { @@ -38,15 +38,15 @@ func (m *RecursionDetection) HandleBuild( } _, hasLambdaEnv := os.LookupEnv(envAwsLambdaFunctionName) - xAmznTraceID, hasTraceID := os.LookupEnv(envAmznTraceId) - value := req.Header.Get(amznTraceIdHeader) + xAmznTraceID, hasTraceID := os.LookupEnv(envAmznTraceID) + value := req.Header.Get(amznTraceIDHeader) // only set the X-Amzn-Trace-Id header when it is not set initially, the // current environment is Lambda and the _X_AMZN_TRACE_ID env variable exists if value != "" || !hasLambdaEnv || !hasTraceID { return next.HandleBuild(ctx, in) } - req.Header.Set(amznTraceIdHeader, percentEncode(xAmznTraceID)) + req.Header.Set(amznTraceIDHeader, percentEncode(xAmznTraceID)) return next.HandleBuild(ctx, in) } diff --git a/aws/middleware/recursion_detection_test.go b/aws/middleware/recursion_detection_test.go index 64e79c5eb68..0f4122231a2 100644 --- a/aws/middleware/recursion_detection_test.go +++ b/aws/middleware/recursion_detection_test.go @@ -49,11 +49,11 @@ func TestRecursionDetection(t *testing.T) { defer restoreEnv() setEnvVar(t, envAwsLambdaFunctionName, c.LambdaFuncName) - setEnvVar(t, envAmznTraceId, c.TraceID) + setEnvVar(t, envAmznTraceID, c.TraceID) req := smithyhttp.NewStackRequest().(*smithyhttp.Request) if c.HeaderBefore != "" { - req.Header.Set(amznTraceIdHeader, c.HeaderBefore) + req.Header.Set(amznTraceIDHeader, c.HeaderBefore) } var updatedRequest *smithyhttp.Request m := RecursionDetection{} @@ -69,7 +69,7 @@ func TestRecursionDetection(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - if e, a := c.HeaderAfter, updatedRequest.Header.Get(amznTraceIdHeader); e != a { + if e, a := c.HeaderAfter, updatedRequest.Header.Get(amznTraceIDHeader); e != a { t.Errorf("expect header value %v found, got %v", e, a) } })