Skip to content

Commit

Permalink
Fix defer placement
Browse files Browse the repository at this point in the history
  • Loading branch information
ricky-galvao committed Apr 26, 2024
1 parent 4acf684 commit 59cb082
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/protocol/webhook/envelopeBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ func buildEnvelopesFromRequest(c *gin.Context, conf *config.Config, m *meta.Coll
if c.GetHeader("Content-Encoding") == "gzip" {
log.Debug().Msg("🟢 Request body is gzip encoded - attempting to decompress.")
reader, err := gzip.NewReader(bytes.NewReader(reqBody))
defer reader.Close()
if err != nil {
log.Error().Err(err).Msg("🔴 could not decompress gzipped request body")
return envelopes
}
defer reader.Close()
reqBody, err = io.ReadAll(reader)
if err != nil {
log.Error().Err(err).Msg("🔴 could not read decompressed gzipped request body")
Expand Down

0 comments on commit 59cb082

Please sign in to comment.