Skip to content
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

SDK's http.Request Body contains a value when it should be nil #318

Closed
jasdel opened this issue May 31, 2019 · 2 comments
Closed

SDK's http.Request Body contains a value when it should be nil #318

jasdel opened this issue May 31, 2019 · 2 comments
Labels

Comments

@jasdel
Copy link
Contributor

jasdel commented May 31, 2019

The SDK's aws.Request.HTTPRequest.Body member may contain a non-nil value even though the SDK has no intention of sending a Body in the request. The SDK should only build a http.Request with a Body when there is a body to actually send.

@fifarafa
Copy link
Contributor

@jasdel Could you provide some example of situations when body is not needed?

@jasdel
Copy link
Contributor Author

jasdel commented Jun 24, 2019

Hi @fifarafa the SDK is currently always setting the Body field regardless if the API operation will provide a payload. This leads to the circumstance where the SDK setting the Body field causes the Go HTTP client to send the request with chunked transfer encoding which is not expected, and in the case of S3 not supported.

aws/aws-sdk-go#991 is the V1 SDK's issue that resolved this issue. The V2 SDK should prevent this issue from the beginning by only ever setting the http.Request.Body member when a non-zero length payload will be sent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants