RestTemplateXhrTransport fails for a StreamingHttpOutputMessage type request #23030
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
The org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport.XhrRequestCallback relies on the request.getBody() method, which is not supported if the request is an instance of StreamingHttpOutputMessage. The result is that the request will fail in this case.
The request may be a StreamingHttpOutputMessage if the underlying request factory is configured as a streaming request in order to use chunked encoding.
To fix the issue the code should check whether the request is an instance of StreamingHttpOutputMessage and in this case use the StreamingHttpOutputMessage.setBody() method to write to the request body.
The text was updated successfully, but these errors were encountered: