Closed as not planned
Description
Since upgrading Spring Boot from 3.3.x to 3.4.x (spring-web from 6.1.x to 6.2.x) any registered request interceptors are not invoked.
For example we have this RestClient
:
final var restClient = RestClient.builder()
.baseUrl(integralityUrl + "/api")
.requestInterceptor((HttpRequest request, byte[] body, ClientHttpRequestExecution execution) -> {
System.out.println("THIS WILL NOT BE EXECUTED");
return execution.execute(request, body);
})
.build();
restClient.get().uri("/some-endpoint").retrieve();
In this example the requestInterceptor
is never invoked.
When looking into the code of spring-web 6.1.18 and 6.2.0 there is a difference in the retrieve function:
6.1.18
public RestClient.ResponseSpec retrieve() {
RestClient.ResponseSpec responseSpec = (RestClient.ResponseSpec)this.exchangeInternal((x$0, x$1) -> {
return DefaultRestClient.this.new DefaultResponseSpec(x$0, x$1);
}, false);
Assert.state(responseSpec != null, "No ResponseSpec");
return responseSpec;
}
this.exchangeInternal
will invoke createRequest
which will invoke the interceptors.
6.2.0
public RestClient.ResponseSpec retrieve() {
return DefaultRestClient.this.new DefaultResponseSpec(this);
}
this.exchangeInternal
is not invoked.
Is this a bug or should it be configured differently?