Fix HTTP Reactive support according latest SF

This commit is contained in:
Artem Bilan
2017-04-25 11:51:24 -04:00
parent c66540593c
commit a9aeff3ae1
3 changed files with 5 additions and 4 deletions

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()