Skip to content

Commit fc49dd5

Browse files
authored
Fix Lambda Function URL responses. (#872)
Add the headers field to ensure that Lambda Function URL responses are encoded correctly. Signed-off-by: David Calavera <[email protected]>
1 parent f9aeac7 commit fc49dd5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lambda-http/src/response.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,11 @@ impl LambdaResponse {
104104
body,
105105
status_code: status_code as i64,
106106
is_base64_encoded,
107-
// explicitly empty, as API gateway does not properly merge headers and
108-
// multi-value-headers, resulting in duplicate headers
109-
headers: HeaderMap::new(),
107+
// ALB responses are used for ALB integrations as well as
108+
// Lambda Function URLs. The former uses the `multi_value_headers` field,
109+
// while the later uses the `headers` field. We need to return
110+
// both fields to ensure both integrations work correctly.
111+
headers: headers.clone(),
110112
multi_value_headers: headers,
111113
status_description: Some(format!(
112114
"{} {}",

0 commit comments

Comments
 (0)