0

I use the Spring WebFlux WebClient to send a POST request:

String response = client.post()
    .uri(uriBuilder -> uriBuilder.path("path").build())
    .contentType(MediaType.APPLICATION_JSON)
    .bodyValue(requestObject.toString())
    .retrieve()
    .bodyToMono(String.class)
    .block();

The server I sent the request to responds with HTTP/1.1 100-Continue..., after which it sends HTTP/1.1 200 OK with JSON data in the response body.

The problem I now face, is that the code shown above returns immediately after receiving the HTTP/1.1 100-Continue.... This prevents me from reading the JSON data that is received later on the HTTP/1.1 200 OK.

In what way can I keep the WebClient from returning after the HTTP/1.1 100-Continue..., and instead retrieve the rest of the incoming response?

4

0 回答 0