@@ -69,7 +69,9 @@ impl LambdaResponse {
69
69
body,
70
70
is_base64_encoded,
71
71
status_code : status_code as i64 ,
72
- headers : headers. clone ( ) ,
72
+ // explicitly empty, as API gateway does not properly merge headers and
73
+ // multi-value-headers, resulting in duplicate headers
74
+ headers : HeaderMap :: new ( ) ,
73
75
multi_value_headers : headers,
74
76
} ) ,
75
77
#[ cfg( feature = "apigw_http" ) ]
@@ -91,7 +93,9 @@ impl LambdaResponse {
91
93
is_base64_encoded,
92
94
status_code : status_code as i64 ,
93
95
cookies,
94
- headers : headers. clone ( ) ,
96
+ // explicitly empty, as API gateway does not properly merge headers and
97
+ // multi-value-headers, resulting in duplicate headers
98
+ headers : HeaderMap :: new ( ) ,
95
99
multi_value_headers : headers,
96
100
} )
97
101
}
@@ -100,7 +104,9 @@ impl LambdaResponse {
100
104
body,
101
105
status_code : status_code as i64 ,
102
106
is_base64_encoded,
103
- headers : headers. clone ( ) ,
107
+ // explicitly empty, as API gateway does not properly merge headers and
108
+ // multi-value-headers, resulting in duplicate headers
109
+ headers : HeaderMap :: new ( ) ,
104
110
multi_value_headers : headers,
105
111
status_description : Some ( format ! (
106
112
"{} {}" ,
@@ -113,7 +119,9 @@ impl LambdaResponse {
113
119
body,
114
120
is_base64_encoded,
115
121
status_code : status_code as i64 ,
116
- headers : headers. clone ( ) ,
122
+ // explicitly empty, as API gateway does not properly merge headers and
123
+ // multi-value-headers, resulting in duplicate headers
124
+ headers : HeaderMap :: new ( ) ,
117
125
multi_value_headers : headers,
118
126
} ) ,
119
127
#[ cfg( feature = "pass_through" ) ]
@@ -465,7 +473,7 @@ mod tests {
465
473
let json = serde_json:: to_string ( & response) . expect ( "failed to serialize to json" ) ;
466
474
assert_eq ! (
467
475
json,
468
- r#"{"statusCode":200,"headers":{"content-encoding":"gzip" },"multiValueHeaders":{"content-encoding":["gzip"]},"body":"MDAwMDAw","isBase64Encoded":true,"cookies":[]}"#
476
+ r#"{"statusCode":200,"headers":{},"multiValueHeaders":{"content-encoding":["gzip"]},"body":"MDAwMDAw","isBase64Encoded":true,"cookies":[]}"#
469
477
)
470
478
}
471
479
@@ -483,7 +491,7 @@ mod tests {
483
491
let json = serde_json:: to_string ( & response) . expect ( "failed to serialize to json" ) ;
484
492
assert_eq ! (
485
493
json,
486
- r#"{"statusCode":200,"headers":{"content-type":"application/json" },"multiValueHeaders":{"content-type":["application/json"]},"body":"000000","isBase64Encoded":false,"cookies":[]}"#
494
+ r#"{"statusCode":200,"headers":{},"multiValueHeaders":{"content-type":["application/json"]},"body":"000000","isBase64Encoded":false,"cookies":[]}"#
487
495
)
488
496
}
489
497
@@ -501,7 +509,7 @@ mod tests {
501
509
let json = serde_json:: to_string ( & response) . expect ( "failed to serialize to json" ) ;
502
510
assert_eq ! (
503
511
json,
504
- r#"{"statusCode":200,"headers":{"content-type":"application/json; charset=utf-16" },"multiValueHeaders":{"content-type":["application/json; charset=utf-16"]},"body":"〰〰〰","isBase64Encoded":false,"cookies":[]}"#
512
+ r#"{"statusCode":200,"headers":{},"multiValueHeaders":{"content-type":["application/json; charset=utf-16"]},"body":"〰〰〰","isBase64Encoded":false,"cookies":[]}"#
505
513
)
506
514
}
507
515
@@ -519,7 +527,7 @@ mod tests {
519
527
let json = serde_json:: to_string ( & response) . expect ( "failed to serialize to json" ) ;
520
528
assert_eq ! (
521
529
json,
522
- r#"{"statusCode":200,"headers":{"content-type":"application/graphql-response+json; charset=utf-16" },"multiValueHeaders":{"content-type":["application/graphql-response+json; charset=utf-16"]},"body":"〰〰〰","isBase64Encoded":false,"cookies":[]}"#
530
+ r#"{"statusCode":200,"headers":{},"multiValueHeaders":{"content-type":["application/graphql-response+json; charset=utf-16"]},"body":"〰〰〰","isBase64Encoded":false,"cookies":[]}"#
523
531
)
524
532
}
525
533
@@ -553,7 +561,7 @@ mod tests {
553
561
let json = serde_json:: to_string ( & res) . expect ( "failed to serialize to json" ) ;
554
562
assert_eq ! (
555
563
json,
556
- r#"{"statusCode":200,"headers":{"multi":"a" },"multiValueHeaders":{"multi":["a","b"]},"isBase64Encoded":false}"#
564
+ r#"{"statusCode":200,"headers":{},"multiValueHeaders":{"multi":["a","b"]},"isBase64Encoded":false}"#
557
565
)
558
566
}
559
567
0 commit comments