Fix HTTP Reactive support according latest SF
This commit is contained in:
@@ -33,6 +33,7 @@ import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.reactive.function.BodyExtractors;
|
||||
import org.springframework.web.reactive.function.BodyInserters;
|
||||
import org.springframework.web.reactive.function.client.ClientResponse;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
import org.springframework.web.reactive.function.client.WebClientException;
|
||||
@@ -120,7 +121,7 @@ public class ReactiveHttpRequestExecutingMessageHandler extends AbstractHttpRequ
|
||||
.headers(httpRequest.getHeaders());
|
||||
|
||||
if (httpRequest.hasBody()) {
|
||||
requestSpec.body(httpRequest.getBody());
|
||||
requestSpec.body(BodyInserters.fromObject(httpRequest.getBody()));
|
||||
}
|
||||
|
||||
Mono<ClientResponse> responseMono = requestSpec.exchange()
|
||||
|
||||
@@ -121,7 +121,7 @@ public class HttpDslTests {
|
||||
response.getHeaders().setContentType(MediaType.TEXT_PLAIN);
|
||||
|
||||
return response.writeWith(Mono.just(response.bufferFactory().wrap("FOO".getBytes())))
|
||||
.then(response::setComplete);
|
||||
.then(Mono.defer(response::setComplete));
|
||||
});
|
||||
|
||||
WebClient webClient = WebClient.builder()
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ReactiveHttpRequestExecutingMessageHandlerTests {
|
||||
ClientHttpConnector httpConnector = new HttpHandlerConnector((request, response) -> {
|
||||
response.setStatusCode(HttpStatus.OK);
|
||||
return Mono.empty()
|
||||
.then(response::setComplete);
|
||||
.then(Mono.defer(response::setComplete));
|
||||
});
|
||||
|
||||
WebClient webClient = WebClient.builder()
|
||||
@@ -79,7 +79,7 @@ public class ReactiveHttpRequestExecutingMessageHandlerTests {
|
||||
ClientHttpConnector httpConnector = new HttpHandlerConnector((request, response) -> {
|
||||
response.setStatusCode(HttpStatus.UNAUTHORIZED);
|
||||
return Mono.empty()
|
||||
.then(response::setComplete);
|
||||
.then(Mono.defer(response::setComplete));
|
||||
});
|
||||
|
||||
WebClient webClient = WebClient.builder()
|
||||
|
||||
Reference in New Issue
Block a user