- Newest
- Most votes
- Most comments
It seems like the AWS CRT HTTP client is not really a full HTTP client to replace the built-in Java HTTP client. It's meant to be configured and then injected into other AWS service clients. We decided to continue using the standard Java HTTP client and drop the use of the AWS CRT HTTP client for our HTTP requests.
The issue you're encountering is related to how the request body is being handled by the AWS CRT HTTP client. In AWS SDK for Java v2, the SdkHttpFullRequest builder and HttpExecuteRequest builder both have a method to set the request body using ContentStreamProvider. However, it seems like the AWS CRT HTTP client is not correctly passing the request body.
To solve this, ensure that the ContentStreamProvider is correctly associated with the request and that the body is not being overwritten or ignored by the client configuration
Relevant content
- Accepted Answerasked 2 months ago
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 5 months ago
Thank you for your response. The ContentStreamProvider seems properly associated with the request. I can set a breakpoint near the point of the execution of the request, and I see at the line
HttpStreamBase stream = httpClientConnectionMakeRequest(this.getNativeHandle(), request.marshalForJni(), request.getBodyStream(), new HttpStreamResponseHandlerNativeAdapter(streamHandler));
that therequest.getBodyStream()
value contains the data I would like to include. The is line #50 within themakeRequest()
method within the HttpClientConnection.java file. I am setting ContentStreamProvider with the HttpExecuteRequest builder.Perhaps I lack an understanding of the low-level implementation of this client. I am expecting my server to receive the data within the request's message body per RFC 7230. Do my servers need to handle the message body differently than a normal POST request? "Normally", this data is accessible within the request's data field in Flask or also the
data
attribute via cURL as described here. I can post the data to my test servers using cURL, but the servers are not receiving the data if I use this AWS CRT HTTP Client.