Skip to content

Commit

Permalink
Modify and Merge request compression middleware logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianyi Wang committed Nov 2, 2023
1 parent 80428e2 commit 560c9cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aws/middleware/request_compression.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ func (m requestCompression) HandleBuild(
return out, metadata, fmt.Errorf("failed to compress request stream, %v", err)
}

if newReq, err := req.SetStream(bytes.NewReader(compressedBytes)); err != nil {
var newReq *smithyhttp.Request
if newReq, err = req.SetStream(bytes.NewReader(compressedBytes)); err != nil {
return out, metadata, fmt.Errorf("failed to set request stream, %v", err)
} else {
*req = *newReq
}
*req = *newReq
isCompressed = true
} else if req.ContentLength >= m.requestMinCompressSizeBytes {
compressedBytes, err := compress(req.Body)
Expand Down

0 comments on commit 560c9cc

Please sign in to comment.