You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
calls to the service result error out with the message non-positive contentLength: 0.
The call can be made to work by either removing the requestFactory call to the RestClient builder or by adding a dummy @RequestBody parameter to the interface
poutsma
changed the title
BufferingClientHttpRequestFactory not usable with empty request body
JdkClientHttpRequest does not support Content-Length 0
Oct 23, 2023
Affects: Spring Framework 6.1.0-M5 (via Spring Boot 3.2.0-M3)
With an
@HttpExchange
interface that only has@RequestParam
parameters similar toand a
RestClient
configured with aBufferingClientHttpRequestFactory
:calls to the service result error out with the message
non-positive contentLength: 0
.The call can be made to work by either removing the
requestFactory
call to theRestClient
builder or by adding a dummy@RequestBody
parameter to the interfaceThe problem, I believe, is in the content length check in org.springframework.http.client.JdkClientHttpRequest#bodyPublisher:
If, with a debugger, I change the value of
contentLength
to -1, the call also succeeds which suggests that the check should beif(contentLength <= 0)
The text was updated successfully, but these errors were encountered: