Skip to content

Commit

Permalink
correctly update ContentLength for uncompressed response body
Browse files Browse the repository at this point in the history
Signed-off-by: ruitianzhong <ruitian-zhong@outlook.com>
  • Loading branch information
ruitianzhong authored and cfc4n committed Mar 2, 2024
1 parent b12878b commit e07cf53
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/event_processor/http_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,15 @@ func (hr *HTTPResponse) Display() []byte {
log.Println(err)
break
}
gbuf, err := io.ReadAll(reader)
if err != nil {
log.Println(err)
break
}

hr.response.Body = io.NopCloser(bytes.NewReader(gbuf))
// gzip uncompressed success
hr.response.Body = reader
hr.response.ContentLength = int64(len(gbuf))
hr.packerType = PacketTypeGzip
defer reader.Close()
default:
Expand Down

0 comments on commit e07cf53

Please sign in to comment.