Merge branch '7.0.x'

This commit is contained in:
rstoyanchev
2026-03-31 11:00:51 +01:00
5 changed files with 50 additions and 4 deletions
@@ -200,6 +200,26 @@ class RestClientAdapterTests {
assertThat(actualResponse).isEqualTo("Hello Spring 2!");
}
@Test // gh-36514
void greetingWithDefaultApiVersion() throws Exception {
prepareResponse(builder ->
builder.setHeader("Content-Type", "text/plain").body("Hello Spring 2!"));
RestClient restClient = RestClient.builder()
.baseUrl(anotherServer.url("/").toString())
.defaultApiVersion("1.0")
.apiVersionInserter(ApiVersionInserter.useHeader("X-Version"))
.build();
String actualResponse =
HttpServiceProxyFactory.builderFor(RestClientAdapter.create(restClient)).build()
.createClient(Service.class).getGreeting();
RecordedRequest request = anotherServer.takeRequest();
assertThat(request.getHeaders().get("X-Version")).isEqualTo("1.0");
assertThat(actualResponse).isEqualTo("Hello Spring 2!");
}
@Test // see gh-36326
void getBodyWithGenericReturnType() {
prepareResponse(r -> r.setHeader("Content-Type", "application/json").body("{\"name\":\"Karl\"}"));