5

I'm fairly new to Spring Webflux and working with the WebClient. What I have is for example a POST-Request being performed something like this:

Mono<ResponseEntity<Resource>> dotResponse = this.webClient
            .method(HttpMethod.POST)
            .uri(new URI("https://test.com/something"))
            .headers(headers -> headers.addAll(requestHeaders))
            .body(BodyInserters.fromResource(resource))
            .exchange()
            .flatMap(response -> response.toEntity(Resource.class));

In reality the code is a bit more complex, but this example is sufficient as a demonstration for the fundamental problem. Anyway this does work and I get the desired result. Now since the resource can be quite big, I want to use an "Expect: 100-continue"-header.

The problem is, what I get now is an empty 100 response, without any clue on how to trigger the remaining request. I couldn't find anything on Google or Stack Overflow, on how to approach this.

I would be most grateful for any pointers.

  • `100-continue header.` what does this mean ? you mean you wanna hot this request 100 times? – KOTIOS Feb 19 '19 at 04:49
  • What I mean is setting the header 'Expect: 100-continue'. [More about the expect header.](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect) This way authorization will be checked before sending the whole payload. It's something you would do, when sending big files. Otherwise you upload like 1gb and than get rejected because of missing authorization. Not great. – Grumpy Quokka Feb 19 '19 at 06:53
  • Did you ever solve this? – Tobiq Aug 27 '21 at 14:31
  • Never did. I did leave the project fairly soon after asking. – Grumpy Quokka Mar 25 '22 at 10:21

0 Answers0