Skip to content

Commit

Permalink
Add comment on why we copy request body
Browse files Browse the repository at this point in the history
  • Loading branch information
alvinlin123 committed Jan 25, 2024
1 parent 5882e2a commit 4a9c051
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions handler/proxy_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ func (p *ProxyClient) Do(req *http.Request) (*http.Response, error) {
log.WithField("request", string(initialReqDump)).Debug("Initial request dump:")
}

// Save the request body into memory so that it's rewindable during retry.
// See https://github.com/awslabs/aws-sigv4-proxy/issues/185
// This may increase memory demand, but the demand should be ok for most cases. If there
// are cases proven to be very problematic, we can consider adding a flag to disable this.
proxyReqBody, err := io.ReadAll(req.Body)
if err != nil {
return nil, err
Expand Down

0 comments on commit 4a9c051

Please sign in to comment.