Reputation: 1933
I created bunch of REST API end points using Spring Webflux reactive libraries. The issue I am facing now is that the responses that spring Webflux returns have transfer-encoding: chunked HTTP header. Because of which client side application using library like Axios (https://github.com/axios/axios) promise based HTTP client from the browser javascript is failing. How can we turnoff transfer-encoding: chunked ?
Example Response from Spring webflux app using curl:
< HTTP/1.1 200 OK
< transfer-encoding: chunked
< Content-Type: application/json;charset=UTF-8
<
[{"default_project_id":"admin","description" .......
"name":**"use* Connection #0 to host 10.1.0.9 left intact**
r1"}},"links":{"self":"http://10.10.10.51:5000/v3/users/f6ee9d6217404d2ba73f323edff06bf8"},
"password_expires_at":null,
"id":"f6ee9d6217404d2ba73f323edff06bf8"}]
Please help. I am seeing the entire response but the chunking of the response is throwing off http client libraries especially consuming them from web browser.
Upvotes: 3
Views: 5687
Reputation: 59141
I don't think you can disable chunked encoding with Reactor Netty (the default server used by Spring Boot + WebFlux). The alternative would be to set the Content-Length
header, which means buffering the whole response before writing it to the network. That's not really optimal for backpressure support.
I looked up the axios client and I've only found an opened issue about HTTP streaming support, which is different from Transfer-Encoding: chunked
. Could you elaborate more about how you came to that conclusion?
Upvotes: 4