@@ -11,10 +11,7 @@ use aws_lambda_events::encodings::Body;
1111use encoding_rs:: Encoding ;
1212use http:: header:: CONTENT_ENCODING ;
1313use http:: HeaderMap ;
14- use http:: {
15- header:: { CONTENT_TYPE , SET_COOKIE } ,
16- Response ,
17- } ;
14+ use http:: { header:: CONTENT_TYPE , Response } ;
1815use http_body:: Body as HttpBody ;
1916use hyper:: body:: to_bytes;
2017use mime:: { Mime , CHARSET } ;
@@ -28,15 +25,15 @@ const X_LAMBDA_HTTP_CONTENT_ENCODING: &str = "x-lambda-http-content-encoding";
2825// See list of common MIME types:
2926// - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
3027// - https://github.com/ietf-wg-httpapi/mediatypes/blob/main/draft-ietf-httpapi-yaml-mediatypes.md
31- const TEXT_ENCODING_PREFIXES : [ & ' static str ; 5 ] = [
28+ const TEXT_ENCODING_PREFIXES : [ & str ; 5 ] = [
3229 "text" ,
3330 "application/json" ,
3431 "application/javascript" ,
3532 "application/xml" ,
3633 "application/yaml" ,
3734] ;
3835
39- const TEXT_ENCODING_SUFFIXES : [ & ' static str ; 3 ] = [ "+xml" , "+yaml" , "+json" ] ;
36+ const TEXT_ENCODING_SUFFIXES : [ & str ; 3 ] = [ "+xml" , "+yaml" , "+json" ] ;
4037
4138/// Representation of Lambda response
4239#[ doc( hidden) ]
@@ -61,7 +58,7 @@ impl LambdaResponse {
6158 b @ Body :: Binary ( _) => ( true , Some ( b) ) ,
6259 } ;
6360
64- let mut headers = parts. headers ;
61+ let headers = parts. headers ;
6562 let status_code = parts. status . as_u16 ( ) ;
6663
6764 match request_origin {
@@ -75,6 +72,8 @@ impl LambdaResponse {
7572 } ) ,
7673 #[ cfg( feature = "apigw_http" ) ]
7774 RequestOrigin :: ApiGatewayV2 => {
75+ use http:: header:: SET_COOKIE ;
76+ let mut headers = headers;
7877 // ApiGatewayV2 expects the set-cookies headers to be in the "cookies" attribute,
7978 // so remove them from the headers.
8079 let cookies = headers
0 commit comments