Skip to content

Commit 5949987

Browse files
authored
fix APIGW transformers to not do value replacement on port (#12021)
1 parent 412122d commit 5949987

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

localstack-core/localstack/testing/snapshots/transformer_utility.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ def apigateway_invocation_headers():
217217
),
218218
TransformerUtility.key_value("X-Amzn-Apigateway-Api-Id"),
219219
TransformerUtility.key_value("X-Forwarded-For"),
220-
TransformerUtility.key_value("X-Forwarded-Port"),
220+
TransformerUtility.key_value(
221+
"X-Forwarded-Port",
222+
value_replacement="<X-Forwarded-Port>",
223+
reference_replacement=False,
224+
),
221225
TransformerUtility.key_value(
222226
"X-Forwarded-Proto",
223227
value_replacement="<X-Forwarded-Proto>",

tests/aws/services/apigateway/test_apigateway_integrations.snapshot.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@
436436
}
437437
},
438438
"tests/aws/services/apigateway/test_apigateway_integrations.py::TestApiGatewayHeaderRemapping::test_apigateway_header_remapping_http[HTTP]": {
439-
"recorded-date": "17-07-2024, 18:34:51",
439+
"recorded-date": "11-12-2024, 15:28:47",
440440
"recorded-content": {
441441
"apigw-id": "<apigw-id:1>",
442442
"no-param-integration": {
@@ -451,7 +451,7 @@
451451
},
452452
"response-headers": {
453453
"Connection": "close",
454-
"Content-Length": "463",
454+
"Content-Length": "462",
455455
"Content-Type": "application/json",
456456
"Date": "<Date>",
457457
"X-Amzn-Trace-Id": "<X-Amzn-Trace-Id>",
@@ -521,7 +521,7 @@
521521
"Age": "response_param_Age",
522522
"Connection": "close",
523523
"Content-Encoding": "response_param_Content-Encoding",
524-
"Content-Length": "2740",
524+
"Content-Length": "2739",
525525
"Content-Type": "response_param_Content-Type",
526526
"Date": "<Date>",
527527
"Pragma": "response_param_Pragma",
@@ -580,7 +580,7 @@
580580
}
581581
},
582582
"tests/aws/services/apigateway/test_apigateway_integrations.py::TestApiGatewayHeaderRemapping::test_apigateway_header_remapping_http[HTTP_PROXY]": {
583-
"recorded-date": "17-07-2024, 18:35:02",
583+
"recorded-date": "11-12-2024, 15:29:02",
584584
"recorded-content": {
585585
"apigw-id": "<apigw-id:1>",
586586
"no-param-integration": {
@@ -607,12 +607,12 @@
607607
"Access-Control-Allow-Credentials": "true",
608608
"Access-Control-Allow-Origin": "*",
609609
"Connection": "close",
610-
"Content-Length": "791",
610+
"Content-Length": "790",
611611
"Content-Type": "application/json",
612612
"Date": "<Date>",
613613
"x-amz-apigw-id": "<x-amz-apigw-id>",
614614
"x-amzn-Remapped-Connection": "keep-alive",
615-
"x-amzn-Remapped-Content-Length": "791",
615+
"x-amzn-Remapped-Content-Length": "790",
616616
"x-amzn-Remapped-Date": "<x-amzn-Remapped-Date>",
617617
"x-amzn-Remapped-Server": "gunicorn/19.9.0",
618618
"x-amzn-RequestId": "<uuid:1>"
@@ -649,12 +649,12 @@
649649
"Access-Control-Allow-Credentials": "true",
650650
"Access-Control-Allow-Origin": "*",
651651
"Connection": "close",
652-
"Content-Length": "1189",
652+
"Content-Length": "1188",
653653
"Content-Type": "application/json",
654654
"Date": "<Date>",
655655
"x-amz-apigw-id": "<x-amz-apigw-id>",
656656
"x-amzn-Remapped-Connection": "keep-alive",
657-
"x-amzn-Remapped-Content-Length": "1189",
657+
"x-amzn-Remapped-Content-Length": "1188",
658658
"x-amzn-Remapped-Date": "<x-amzn-Remapped-Date>",
659659
"x-amzn-Remapped-Server": "gunicorn/19.9.0",
660660
"x-amzn-RequestId": "<uuid:2>"
@@ -691,7 +691,7 @@
691691
}
692692
},
693693
"tests/aws/services/apigateway/test_apigateway_integrations.py::TestApiGatewayHeaderRemapping::test_apigateway_header_remapping_aws[AWS]": {
694-
"recorded-date": "18-07-2024, 23:22:48",
694+
"recorded-date": "11-12-2024, 15:29:40",
695695
"recorded-content": {
696696
"apigw-id": "<apigw-id:1>",
697697
"no-param-integration": {
@@ -874,7 +874,7 @@
874874
}
875875
},
876876
"tests/aws/services/apigateway/test_apigateway_integrations.py::TestApiGatewayHeaderRemapping::test_apigateway_header_remapping_aws[AWS_PROXY]": {
877-
"recorded-date": "18-07-2024, 23:23:10",
877+
"recorded-date": "11-12-2024, 15:29:56",
878878
"recorded-content": {
879879
"apigw-id": "<apigw-id:1>",
880880
"no-param-integration": {
@@ -897,12 +897,12 @@
897897
"Warn": "299 localStack/0.0",
898898
"X-Amzn-Trace-Id": "<X-Amzn-Trace-Id>",
899899
"X-Forwarded-For": "<x--forwarded--for:1>",
900-
"X-Forwarded-Port": "<x--forwarded--port:1>",
900+
"X-Forwarded-Port": "<X-Forwarded-Port>",
901901
"X-Forwarded-Proto": "<X-Forwarded-Proto>"
902902
},
903903
"response-headers": {
904904
"Connection": "close",
905-
"Content-Length": "2339",
905+
"Content-Length": "2336",
906906
"Content-Type": "application/json",
907907
"Date": "<Date>",
908908
"X-Amzn-Trace-Id": "<X-Amzn-Trace-Id>",
@@ -930,12 +930,12 @@
930930
"Warn": "299 localStack/0.0",
931931
"X-Amzn-Trace-Id": "<X-Amzn-Trace-Id>",
932932
"X-Forwarded-For": "<x--forwarded--for:1>",
933-
"X-Forwarded-Port": "<x--forwarded--port:1>",
933+
"X-Forwarded-Port": "<X-Forwarded-Port>",
934934
"X-Forwarded-Proto": "<X-Forwarded-Proto>"
935935
},
936936
"response-headers": {
937937
"Connection": "close",
938-
"Content-Length": "2323",
938+
"Content-Length": "2320",
939939
"Content-Type": "application/json",
940940
"Date": "<Date>",
941941
"X-Amzn-Trace-Id": "<X-Amzn-Trace-Id>",

tests/aws/services/apigateway/test_apigateway_integrations.validation.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"tests/aws/services/apigateway/test_apigateway_integrations.py::TestApiGatewayHeaderRemapping::test_apigateway_header_remapping_aws[AWS]": {
3-
"last_validated_date": "2024-07-18T23:22:46+00:00"
3+
"last_validated_date": "2024-12-11T15:29:38+00:00"
44
},
55
"tests/aws/services/apigateway/test_apigateway_integrations.py::TestApiGatewayHeaderRemapping::test_apigateway_header_remapping_aws[AWS_PROXY]": {
6-
"last_validated_date": "2024-07-18T23:23:04+00:00"
6+
"last_validated_date": "2024-12-11T15:29:54+00:00"
77
},
88
"tests/aws/services/apigateway/test_apigateway_integrations.py::TestApiGatewayHeaderRemapping::test_apigateway_header_remapping_http[HTTP]": {
9-
"last_validated_date": "2024-07-17T18:34:51+00:00"
9+
"last_validated_date": "2024-12-11T15:28:46+00:00"
1010
},
1111
"tests/aws/services/apigateway/test_apigateway_integrations.py::TestApiGatewayHeaderRemapping::test_apigateway_header_remapping_http[HTTP_PROXY]": {
12-
"last_validated_date": "2024-07-17T18:34:56+00:00"
12+
"last_validated_date": "2024-12-11T15:28:54+00:00"
1313
},
1414
"tests/aws/services/apigateway/test_apigateway_integrations.py::test_create_execute_api_vpc_endpoint": {
1515
"last_validated_date": "2024-04-15T23:07:07+00:00"

0 commit comments

Comments
 (0)