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
WebClient - add option to disable chunked transfer [SPR-15914] #20468
Comments
Arjen Poutsma commented The chunked transfer-encoding headers is coming from Reactor Netty, the underlying HTTP library. There is an open issue to add a global option for disabling it. Once there, the configuration option can easily be used via this ReactorClientHttpConnector constructor. |
Alex commented It seems like Reactor Netty has added the feature, but I don't still find the option in ReactorClientHttpConnector constructor now. Is there any plan to support it or am I missing something? |
Arjen Poutsma commented Alex It has been added in the 0.8.x branch, while Spring Framework is on 0.7. We will upgrade to 0.8.x as part of the 5.1 cycle. In the mean time, I've asked for that feature to be back ported to 0.7, see my comment on the linked issue. |
Simon commented It would be really nice to be able to use WebClient for communicating with resources that dont support chunked encoding and to avoid adding additional 3rd party dependencies for just doing that. |
Simon commented It would also be nice to be able to configure it using the WebClient.Builder without the need to use the reactor.netty.http.client.HttpClient |
Even when setting the Content-Length header at WebClient Level, this one is not passed to Netty at "configured" state, and Netty keeps chunking. |
Any update on this issue, please? I'm setting webclient.contentLength() explicitly still the response is getting chunked. |
I don't think there is anything to update. According to the Javadoc of HttpClient: * {@code Transfer-Encoding: chunked} will be applied for those HTTP methods for which
* a request body is expected. {@code Content-Length} provided via request headers
* will disable {@code Transfer-Encoding: chunked}. In other words, this is in Reactor Netty and unless WebClient is somehow not passing the header, I don't see how it could be related to it. |
I found an interesting pointer:
|
so, is there any way to disable chunked transfer or calculate encoded multipart/form-data part's content-length when using declare http interface ? e.g. @HttpExchange("/V1.0")
interface Client {
@PostExchange("upload")
fun postFile(
@RequestPart file: Resource,
//@RequestHeader("Content-Length") contentLength: Int
): Mono<String>
} how can i set the correct content length header? |
Marek Hawrylczak opened SPR-15914 and commented
Currently all requests except GET and HEAD are using transfer-encoding: chunked. There is no way to disable it, thus is not possible to call a network device that cannot support chunked transfer.
Affects: 5.0 RC3
The text was updated successfully, but these errors were encountered: