-
Notifications
You must be signed in to change notification settings - Fork 32
fix: overwrite Content-Length
rather than appending
#1407
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
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Content-Length
rather than appendingContent-Length
rather than appending
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
val contentLength = body.contentLength?.takeIf { it >= 0 }?.toString() ?: headers[CONTENT_LENGTH_HEADER] | ||
contentLength?.let { crtHeaders.append(CONTENT_LENGTH_HEADER, it) } | ||
contentLength?.let { crtHeaders[CONTENT_LENGTH_HEADER] = it } | ||
|
||
return aws.sdk.kotlin.crt.http.HttpRequest(method.name, url.requestRelativePath, crtHeaders.build(), bodyStream) |
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 we add a new test for this? And also one that verifies the (presumably already correct?) behavior in OkHttp engine?
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.
Added some tests
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
Affected ArtifactsNo artifacts changed size |
We were appending to
Content-Length
rather than overwriting it. This means if content length was already set by the user, we send a list of content lengths, causing a signature mismatch.Issue #
Description of changes
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.