DefaultRestClientBuilder.defaultClient(Consumer<RestClient.RequestHeadersSpec<?>>) can be used to set a property, but that property is never actually used when building the RestClient.
Is this related to #31625?
Comment From: injae-kim
https://github.com/spring-projects/spring-framework/blob/0c42965fc36f19868fbba382b2e03ed172087438/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClientBuilder.java#L325-L330
https://github.com/spring-projects/spring-framework/blob/0c42965fc36f19868fbba382b2e03ed172087438/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java#L481-L484
Hi @poutsma ! I found that DefaultWebClient&Builder set&pass Consumer<WebClient.RequestHeadersSpec<?>> defaultRequest; from builder to client and DefaulltWebClient use it well on initRequestBuiilder() like above!
https://github.com/spring-projects/spring-framework/commit/0820210c7c7dbc0a58730c09196b6b52c4732f17 Introduce RestClient
https://github.com/spring-projects/spring-framework/blob/0c42965fc36f19868fbba382b2e03ed172087438/spring-web/src/main/java/org/springframework/web/client/DefaultRestClientBuilder.java#L117
https://github.com/spring-projects/spring-framework/blob/0c42965fc36f19868fbba382b2e03ed172087438/spring-web/src/main/java/org/springframework/web/client/DefaultRestClientBuilder.java#L365-L380
But on RestClient&Builder that introduced on above commit, I think we miss to pass defaultRequest from builder to DefaultRestClient on build() 😅
(also there's no unit test for defaultRequest on DefaultRestClient&Builder)
Comment From: injae-kim
oh based on https://github.com/spring-projects/spring-framework/issues/31625, I'm not sure but maybe DefaultRestClientBuilder.defaultRequest is intended to be unused. (it's experimental feature?)
Waiting your opinion~! thanks!
Anyway, I created fix PR https://github.com/spring-projects/spring-framework/pull/32034 so feel free to close it if my fix is not what you want😃
Comment From: poutsma
@ThomasKasene Indeed this was an oversight similar to #31625. In this case, however, we can enable support for the feature without making API changes, so I will commit a change shortly.
@injae-kim I did not see your PR until just now, and have already prepared a fix myself. Our fixes are fairly similar, by the looks of it, though I decided to follow the behaviour of WebClient more closely by invoking the request handler before the URI is initialised.
Comment From: injae-kim
already prepared a fix myself
@poutsma aha then feel free to just close my PR~! if there's anything I can contribute or help, please share to me. thanks! 👍