We need to honor Smithy traits. The requiresLength trait further defines the behavior of the SDK when the stream trait is used on a request payload. At the time of writing this SEP, the list of AWS services that use the stream trait in input shapes included
Lambda InvokeAsync (content-length)
CloudSearchDomain UploadDocument (content-length)
S3 PutObject/UploadPart (requiresLength with content-length)
Glacier UploadArchive/UploadMultipart (requiresLength with content-length)
The requiresLength trait is a boolean trait that can only target blob shapes marked with the stream trait.
The shape should be denoted as a payload member.
The payload of the request must be signed by default unless the request's operation is explicitly marked as v4-unsigned-body [2] in its authType trait.
The v4-unsigned-body and requiresLength traits are not mutually exclusive. A given payload shape can be (correctly) marked with both stream and requiresLength, and the associated operation can have authType set to v4-unsigned-body.
The SDK implementation must fail the request if determined that the content-length header must be set but the length of the payload cannot be calculated.
If the length is readily available, set the content-length header. If the length is not readily available, requiresLength is not present, and v4-unsigned-body is present on the operation, set the transfer-encoding: chunked header if using HTTP/1.1. In all other cases, fail the request.
Acknowledgements
[ ] I may be able to implement this feature request
Describe the feature
This is the implementation task for #356 SEP: requires-length-trait.md
Use Case
We need to honor Smithy traits. The
requiresLength
trait further defines the behavior of the SDK when thestream
trait is used on a request payload. At the time of writing this SEP, the list of AWS services that use thestream
trait in input shapes includedInvokeAsync
(content-length
)UploadDocument
(content-length
)PutObject
/UploadPart
(requiresLength
withcontent-length
)UploadArchive
/UploadMultipart
(requiresLength
withcontent-length
)PostContent
([Only HTTP/1.1] (transfer-encoding: chunked
,content-length
if length readily available))PutObject
([Only HTTP/1.1] (transfer-encoding: chunked
,content-length
if length readily available))Proposed Solution
No response
Other Information
Acknowledgements