import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.reactive.JettyClientHttpConnector;
-import org.springframework.web.reactive.function.client.ExchangeFilterFunction;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
.builder()
.clientConnector(new JettyClientHttpConnector())
.baseUrl(server.url("/").toString())
- .filter(GraphApiExchangeFilterFunction.INSTANCE)
.build();
}
.get()
.uri("/egal")
.retrieve()
+ .onStatus(status -> status.is4xxClientError(), response -> GraphApiException.create(response))
.bodyToMono(String.class);
StepVerifier
server
.enqueue(new MockResponse()
- .setResponseCode(200)
+ .setResponseCode(400)
.setHeader("Content-Type", "text/plain")
.setBody("Hello Spring!"));
result = webClient.get()
.uri("/greeting?name=Spring")
.retrieve()
+ .onStatus(status -> status.is4xxClientError(), response -> GraphApiException.create(response))
.bodyToMono(String.class);
StepVerifier.create(result)