mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Support StreamingHttpOutputMessage in RestClient
This commit allows RestClient to handle StreamingHttpOutputMessage properly by checking the type of the request and invoking setBody() when appropriate. This improves interoperability with components that expect streamed output. A new integration test has been added to verify the functionality. See gh-35102 Signed-off-by: Daniil Razorenov <daniltmb@gmail.com>
This commit is contained in:
committed by
rstoyanchev
parent
2477544a8f
commit
8d6117e419
@@ -466,7 +466,14 @@ final class DefaultRestClient implements RestClient {
|
||||
|
||||
@Override
|
||||
public RequestBodySpec body(StreamingHttpOutputMessage.Body body) {
|
||||
this.body = request -> body.writeTo(request.getBody());
|
||||
this.body = request -> {
|
||||
if (request instanceof StreamingHttpOutputMessage streamingMessage) {
|
||||
streamingMessage.setBody(body);
|
||||
}
|
||||
else {
|
||||
body.writeTo(request.getBody());
|
||||
}
|
||||
};
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user