Code: Select all
Map cookieMap = new ConcurrentHashMap();
WebClient webClient =
WebClient.builder()
.clientConnector(
followRedirectsWithCookies(
cookieMap, (String location) -> !location.matches(".*/landingMockFe")))
.baseUrl("http://localhost:" + localPort)
.build();
...
List responses = new ArrayList(5);
for (int i = 0; i < 5; i++) {
responses.add(
webClient
.get()
...
.exchangeToMono(response -> Mono.just(response.statusCode())));
}
Boolean is4xxError = Flux.merge(responses).any(response -> response.is4xxClientError()).block();
String newResponseString = webClient
.get()
.uri("some-other-uri")
...
.retrieve()
.bodyToMono(String.class)
.block();
Jetzt habe ich auf WebFlux 6.2.5, Sicherheit 6.4, Start -Parents 3.4.4, Reactor 3.7.4 und gelegentlich. />
reactor.netty.http.client.prematurecroseException: Verbindung vor dem Antwort vor dem Problem geschlossen vor der Antwort geschlossen. Diese Änderung scheint das Problem zu lösen: < /p>
Code: Select all
int count4xxError =
Flux.merge(responses)
.filter(response -> response.is4xxClientError())
.count()
.block()
.intValue();