-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bg-dropped-reqbody-#46 #1214
Bg-dropped-reqbody-#46 #1214
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for looking into that. one minor question on my side.
Can you also update the changelog please?
@@ -42,24 +42,6 @@ func TestCompressionHandlerAddsContentEncodingHeader(t *testing.T) { | |||
assert.Equal(t, contentTypeHeader, "gzip") | |||
} | |||
|
|||
func TestCompressionHandlerCompressesRequestBody(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you expand on why you decided to remove that test please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not always true that the compressed body will be smaller than the uncompressed body for small payloads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the precision here. We should still check the compression is actually performing compression work in case somebody breaks it in the future. hardcoding the expected size of the result would be ok for that purpose I think.
Kudos, SonarCloud Quality Gate passed! |
Overview
Fixes #46
Notes
Reading from a buffer drains the buffer ie, the buffer will be empty after reading all the bytes in it. The bug occured because
req.Body
was passed tocompressReqBody
after its contents had been read atline 69
which means whatevercompressReqBody
received was empty.