@@ -11,10 +11,7 @@ use aws_lambda_events::encodings::Body;
11
11
use encoding_rs:: Encoding ;
12
12
use http:: header:: CONTENT_ENCODING ;
13
13
use http:: HeaderMap ;
14
- use http:: {
15
- header:: { CONTENT_TYPE , SET_COOKIE } ,
16
- Response ,
17
- } ;
14
+ use http:: { header:: CONTENT_TYPE , Response } ;
18
15
use http_body:: Body as HttpBody ;
19
16
use hyper:: body:: to_bytes;
20
17
use mime:: { Mime , CHARSET } ;
@@ -28,15 +25,15 @@ const X_LAMBDA_HTTP_CONTENT_ENCODING: &str = "x-lambda-http-content-encoding";
28
25
// See list of common MIME types:
29
26
// - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
30
27
// - 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 ] = [
32
29
"text" ,
33
30
"application/json" ,
34
31
"application/javascript" ,
35
32
"application/xml" ,
36
33
"application/yaml" ,
37
34
] ;
38
35
39
- const TEXT_ENCODING_SUFFIXES : [ & ' static str ; 3 ] = [ "+xml" , "+yaml" , "+json" ] ;
36
+ const TEXT_ENCODING_SUFFIXES : [ & str ; 3 ] = [ "+xml" , "+yaml" , "+json" ] ;
40
37
41
38
/// Representation of Lambda response
42
39
#[ doc( hidden) ]
@@ -61,7 +58,7 @@ impl LambdaResponse {
61
58
b @ Body :: Binary ( _) => ( true , Some ( b) ) ,
62
59
} ;
63
60
64
- let mut headers = parts. headers ;
61
+ let headers = parts. headers ;
65
62
let status_code = parts. status . as_u16 ( ) ;
66
63
67
64
match request_origin {
@@ -75,6 +72,8 @@ impl LambdaResponse {
75
72
} ) ,
76
73
#[ cfg( feature = "apigw_http" ) ]
77
74
RequestOrigin :: ApiGatewayV2 => {
75
+ use http:: header:: SET_COOKIE ;
76
+ let mut headers = headers;
78
77
// ApiGatewayV2 expects the set-cookies headers to be in the "cookies" attribute,
79
78
// so remove them from the headers.
80
79
let cookies = headers
0 commit comments