I need to use Spring
reactive WebClient
without default chunked encoding
mode, which is "enforced" by underlying HttpClient
and Netty
based stack. Unfortunately the server I need to communicate with does not support this mode, even thou it supports rest of the HTTP 1.1 specs.
I know there is an option to set Content-Length
header manually, but that requires you to operate with some DataBuffer
like structure and I would like to use as much of the provided support (BodyInserters, Multipart support etc...). After some digging I found something similar is used at HttpClientConfiguration
level for GET
and HEAD
requests, which are buffered in advance. I would like to implement something similar to this, but I am not sure at which level (if it is even possible) best to do so. Ideally I would like to implement some middleware which would only buffer incoming body data until upstream completes and then set Content-Length
for downstream. I am not concerned about memory usage.