Skip to content

Commit

Permalink
Remove "transfer-encoding" header from responses (#442)
Browse files Browse the repository at this point in the history
* Remove hop-by-hop headers from requests and responses

* Only remove hop-by-hop headers from responses

* Only remove "transfer-encoding" from responses
  • Loading branch information
bnusunny authored Apr 20, 2024
1 parent 41e4ce3 commit 035659c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,11 @@ impl Adapter<HttpConnector, Body> {

let request = builder.body(Body::from(body.to_vec()))?;

let app_response = self.client.request(request).await?;
let mut app_response = self.client.request(request).await?;

// remove "transfer-encoding" from the response to support "sam local start-api"
app_response.headers_mut().remove("transfer-encoding");

tracing::debug!(status = %app_response.status(), body_size = ?app_response.body().size_hint().lower(),
app_headers = ?app_response.headers().clone(), "responding to lambda event");

Expand Down

0 comments on commit 035659c

Please sign in to comment.