Spring Webflux:WebClient处理Expect:100-继续

Gru*_*kka 5 http-status-code-100 spring-boot reactor-netty spring-webflux

我对 Spring Webflux 和 WebClient 的使用相当陌生。例如,我所执行的 POST 请求如下:

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));
Run Code Online (Sandbox Code Playgroud)

实际上,代码有点复杂,但这个示例足以演示基本问题。无论如何,这确实有效,并且我得到了想要的结果。现在,由于资源可能相当大,我想使用“Expect:100-continue”标头。

问题是,我现在得到的是一个空的 100 响应,没有任何关于如何触发剩余请求的线索。我在 Google 或 Stack Overflow 上找不到任何关于如何解决这个问题的信息。

如果有任何指点,我将不胜感激。