diff --git a/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java b/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java index d61cfd7f6bf..7903fcfaa43 100644 --- a/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java +++ b/spring-test/src/main/java/org/springframework/test/web/reactive/server/DefaultWebTestClient.java @@ -261,8 +261,8 @@ class DefaultWebTestClient implements WebTestClient { } @Override - public RequestHeadersSpec body(Object body) { - this.bodySpec.body(body); + public RequestHeadersSpec bodyValue(Object body) { + this.bodySpec.bodyValue(body); return this; } @@ -299,7 +299,7 @@ class DefaultWebTestClient implements WebTestClient { @Override @Deprecated public RequestHeadersSpec syncBody(Object body) { - return body(body); + return bodyValue(body); } @Override diff --git a/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java b/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java index 2ac8ceae0eb..4ded01a40f9 100644 --- a/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java +++ b/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java @@ -642,7 +642,7 @@ public interface WebTestClient { * @return spec for decoding the response * @since 5.2 */ - RequestHeadersSpec body(Object body); + RequestHeadersSpec bodyValue(Object body); /** * Set the body of the request to the given producer. @@ -713,7 +713,7 @@ public interface WebTestClient { * @throws IllegalArgumentException if {@code body} is a {@link Publisher} or an * instance of a type supported by {@link ReactiveAdapterRegistry#getSharedInstance()}, * for which {@link #body(Publisher, Class)} or {@link #body(Object, Class)} should be used. - * @deprecated as of Spring Framework 5.2 in favor of {@link #body(Object)} + * @deprecated as of Spring Framework 5.2 in favor of {@link #bodyValue(Object)} */ @Deprecated RequestHeadersSpec syncBody(Object body); diff --git a/spring-test/src/test/java/org/springframework/test/web/reactive/server/ApplicationContextSpecTests.java b/spring-test/src/test/java/org/springframework/test/web/reactive/server/ApplicationContextSpecTests.java index 6333e8b7a64..99e5e6a0749 100644 --- a/spring-test/src/test/java/org/springframework/test/web/reactive/server/ApplicationContextSpecTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/reactive/server/ApplicationContextSpecTests.java @@ -61,7 +61,7 @@ public class ApplicationContextSpecTests { .GET("/sessionClassName", request -> request.session().flatMap(session -> { String className = session.getClass().getSimpleName(); - return ServerResponse.ok().body(className); + return ServerResponse.ok().bodyValue(className); })) .build(); } diff --git a/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/ErrorTests.java b/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/ErrorTests.java index bf9fb617ae1..f2637bc1709 100644 --- a/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/ErrorTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/ErrorTests.java @@ -63,7 +63,7 @@ public class ErrorTests { EntityExchangeResult result = this.client.post() .uri("/post") .contentType(MediaType.APPLICATION_JSON) - .body(new Person("Dan")) + .bodyValue(new Person("Dan")) .exchange() .expectStatus().isBadRequest() .expectBody().isEmpty(); diff --git a/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/JsonContentTests.java b/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/JsonContentTests.java index ea6c3f4ebf1..82d271c8777 100644 --- a/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/JsonContentTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/JsonContentTests.java @@ -82,7 +82,7 @@ public class JsonContentTests { public void postJsonContent() { this.client.post().uri("/persons") .contentType(MediaType.APPLICATION_JSON) - .body("{\"name\":\"John\"}") + .bodyValue("{\"name\":\"John\"}") .exchange() .expectStatus().isCreated() .expectBody().isEmpty(); diff --git a/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/ResponseEntityTests.java b/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/ResponseEntityTests.java index b78e189a18d..3acbf66d984 100644 --- a/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/ResponseEntityTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/ResponseEntityTests.java @@ -145,7 +145,7 @@ public class ResponseEntityTests { @Test public void postEntity() { this.client.post() - .body(new Person("John")) + .bodyValue(new Person("John")) .exchange() .expectStatus().isCreated() .expectHeader().valueEquals("location", "/persons/John") diff --git a/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/XmlContentTests.java b/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/XmlContentTests.java index b50d90f921a..f517f455a0c 100644 --- a/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/XmlContentTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/XmlContentTests.java @@ -116,7 +116,7 @@ public class XmlContentTests { this.client.post().uri("/persons") .contentType(MediaType.APPLICATION_XML) - .body(content) + .bodyValue(content) .exchange() .expectStatus().isCreated() .expectHeader().valueEquals(HttpHeaders.LOCATION, "/persons/John") diff --git a/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/HttpServerTests.java b/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/HttpServerTests.java index f83cfbfc939..27f69a04b80 100644 --- a/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/HttpServerTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/HttpServerTests.java @@ -45,7 +45,7 @@ public class HttpServerTests { @BeforeEach public void start() throws Exception { HttpHandler httpHandler = RouterFunctions.toHttpHandler( - route(GET("/test"), request -> ServerResponse.ok().body("It works!"))); + route(GET("/test"), request -> ServerResponse.ok().bodyValue("It works!"))); this.server = new ReactorHttpServer(); this.server.setHandler(httpHandler); diff --git a/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/RouterFunctionTests.java b/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/RouterFunctionTests.java index 0e14c2c3ab5..b9bb2a98925 100644 --- a/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/RouterFunctionTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/bind/RouterFunctionTests.java @@ -41,7 +41,7 @@ public class RouterFunctionTests { public void setUp() throws Exception { RouterFunction route = route(GET("/test"), request -> - ServerResponse.ok().body("It works!")); + ServerResponse.ok().bodyValue("It works!")); this.testClient = WebTestClient.bindToRouterFunction(route).build(); } diff --git a/spring-test/src/test/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensionsTests.kt b/spring-test/src/test/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensionsTests.kt index 1af130fd9d6..01718f647c6 100644 --- a/spring-test/src/test/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensionsTests.kt +++ b/spring-test/src/test/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensionsTests.kt @@ -70,7 +70,7 @@ class WebTestClientExtensionsTests { @Test fun `KotlinBodySpec#isEqualTo`() { WebTestClient - .bindToRouterFunction( router { GET("/") { ok().body("foo") } } ) + .bindToRouterFunction( router { GET("/") { ok().bodyValue("foo") } } ) .build() .get().uri("/").exchange().expectBody().isEqualTo("foo") } @@ -78,7 +78,7 @@ class WebTestClientExtensionsTests { @Test fun `KotlinBodySpec#consumeWith`() { WebTestClient - .bindToRouterFunction( router { GET("/") { ok().body("foo") } } ) + .bindToRouterFunction( router { GET("/") { ok().bodyValue("foo") } } ) .build() .get().uri("/").exchange().expectBody().consumeWith { assertEquals("foo", it.responseBody) } } @@ -86,7 +86,7 @@ class WebTestClientExtensionsTests { @Test fun `KotlinBodySpec#returnResult`() { WebTestClient - .bindToRouterFunction( router { GET("/") { ok().body("foo") } } ) + .bindToRouterFunction( router { GET("/") { ok().bodyValue("foo") } } ) .build() .get().uri("/").exchange().expectBody().returnResult().apply { assertEquals("foo", responseBody) } } diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java index aca1e02c434..4db8f530cc4 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java @@ -78,7 +78,7 @@ public abstract class BodyInserters { /** * Inserter to write the given object. - *

Alternatively, consider using the {@code body(Object)} shortcuts on + *

Alternatively, consider using the {@code bodyValue(Object)} shortcuts on * {@link org.springframework.web.reactive.function.client.WebClient WebClient} and * {@link org.springframework.web.reactive.function.server.ServerResponse ServerResponse}. * @param body the body to write to the response @@ -227,7 +227,7 @@ public abstract class BodyInserters { * Return a {@link FormInserter} to write the given {@code MultiValueMap} * as URL-encoded form data. The returned inserter allows for additional * entries to be added via {@link FormInserter#with(String, Object)}. - *

Note that you can also use the {@code body(Object)} method in the + *

Note that you can also use the {@code bodyValue(Object)} method in the * request builders of both the {@code WebClient} and {@code WebTestClient}. * In that case the setting of the request content type is also not required, * just be sure the map contains String values only or otherwise it would be @@ -259,7 +259,7 @@ public abstract class BodyInserters { * Object or an {@link HttpEntity}. *

Note that you can also build the multipart data externally with * {@link MultipartBodyBuilder}, and pass the resulting map directly to the - * {@code body(Object)} shortcut method in {@code WebClient}. + * {@code bodyValue(Object)} shortcut method in {@code WebClient}. * @param multipartData the form data to write to the output message * @return the inserter that allows adding more parts * @see MultipartBodyBuilder @@ -275,7 +275,7 @@ public abstract class BodyInserters { * {@link HttpEntity}. *

Note that you can also build the multipart data externally with * {@link MultipartBodyBuilder}, and pass the resulting map directly to the - * {@code body(Object)} shortcut method in {@code WebClient}. + * {@code bodyValue(Object)} shortcut method in {@code WebClient}. * @param name the part name * @param value the part value, an Object or {@code HttpEntity} * @return the inserter that allows adding more parts @@ -291,7 +291,7 @@ public abstract class BodyInserters { * as multipart data. *

Note that you can also build the multipart data externally with * {@link MultipartBodyBuilder}, and pass the resulting map directly to the - * {@code body(Object)} shortcut method in {@code WebClient}. + * {@code bodyValue(Object)} shortcut method in {@code WebClient}. * @param name the part name * @param publisher the publisher that forms the part value * @param elementClass the class contained in the {@code publisher} @@ -309,7 +309,7 @@ public abstract class BodyInserters { * allows specifying generic type information. *

Note that you can also build the multipart data externally with * {@link MultipartBodyBuilder}, and pass the resulting map directly to the - * {@code body(Object)} shortcut method in {@code WebClient}. + * {@code bodyValue(Object)} shortcut method in {@code WebClient}. * @param name the part name * @param publisher the publisher that forms the part value * @param typeReference the type contained in the {@code publisher} diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java index ebd5122ee62..6cd90185bcc 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java @@ -288,7 +288,7 @@ class DefaultWebClient implements WebClient { } @Override - public RequestHeadersSpec body(Object body) { + public RequestHeadersSpec bodyValue(Object body) { this.inserter = BodyInserters.fromObject(body); return this; } @@ -327,7 +327,7 @@ class DefaultWebClient implements WebClient { @Override @Deprecated public RequestHeadersSpec syncBody(Object body) { - return body(body); + return bodyValue(body); } @Override diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java index f5e74bcc58c..fc0cd709023 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java @@ -59,7 +59,7 @@ import org.springframework.web.util.UriBuilderFactory; * *

For examples with a request body see: *

    - *
  • {@link RequestBodySpec#body(Object) body(Object)} + *
  • {@link RequestBodySpec#bodyValue(Object) bodyValue(Object)} *
  • {@link RequestBodySpec#body(Publisher, Class) body(Publisher,Class)} *
  • {@link RequestBodySpec#body(Object, Class) body(Object,Class)} *
  • {@link RequestBodySpec#body(BodyInserter) body(BodyInserter)} @@ -528,7 +528,7 @@ public interface WebClient { * Mono<Void> result = client.post() * .uri("/persons/{id}", id) * .contentType(MediaType.APPLICATION_JSON) - * .body(person) + * .bodyValue(person) * .retrieve() * .bodyToMono(Void.class); * @@ -547,7 +547,7 @@ public interface WebClient { * for which {@link #body(Publisher, Class)} or {@link #body(Object, Class)} should be used. * @since 5.2 */ - RequestHeadersSpec body(Object body); + RequestHeadersSpec bodyValue(Object body); /** * A shortcut for {@link #body(BodyInserter)} with a @@ -657,7 +657,7 @@ public interface WebClient { * @throws IllegalArgumentException if {@code body} is a {@link Publisher} or an * instance of a type supported by {@link ReactiveAdapterRegistry#getSharedInstance()}, * for which {@link #body(Publisher, Class)} or {@link #body(Object, Class)} should be used. - * @deprecated as of Spring Framework 5.2 in favor of {@link #body(Object)} + * @deprecated as of Spring Framework 5.2 in favor of {@link #bodyValue(Object)} */ @Deprecated RequestHeadersSpec syncBody(Object body); diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilder.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilder.java index 6e1e86907b0..87b51269b10 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilder.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilder.java @@ -223,7 +223,7 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder { } @Override - public Mono body(Object body) { + public Mono bodyValue(Object body) { return new DefaultEntityResponseBuilder<>(body, BodyInserters.fromObject(body)) .status(this.statusCode) @@ -286,7 +286,7 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder { @Override @Deprecated public Mono syncBody(Object body) { - return body(body); + return bodyValue(body); } @Override diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerResponse.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerResponse.java index 2a3b886e405..79ff425f1df 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerResponse.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerResponse.java @@ -408,7 +408,7 @@ public interface ServerResponse { * for which {@link #body(Publisher, Class)} or {@link #body(Object, Class)} should be used. * @since 5.2 */ - Mono body(Object body); + Mono bodyValue(Object body); /** * Set the body of the response to the given asynchronous {@code Publisher} and return it. @@ -479,7 +479,7 @@ public interface ServerResponse { * @throws IllegalArgumentException if {@code body} is a {@link Publisher} or an * instance of a type supported by {@link ReactiveAdapterRegistry#getSharedInstance()}, * for which {@link #body(Publisher, Class)} or {@link #body(Object, Class)} should be used. - * @deprecated as of Spring Framework 5.2 in favor of {@link #body(Object)} + * @deprecated as of Spring Framework 5.2 in favor of {@link #bodyValue(Object)} */ @Deprecated Mono syncBody(Object body); diff --git a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensions.kt b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensions.kt index 9703a699ae4..12cfdef9647 100644 --- a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensions.kt +++ b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensions.kt @@ -75,7 +75,7 @@ inline fun ServerResponse.BodyBuilder.bodyWithType(publisher: * instance of a type supported by [org.springframework.core.ReactiveAdapterRegistry.getSharedInstance], */ suspend fun ServerResponse.BodyBuilder.bodyAndAwait(body: Any): ServerResponse = - body(body).awaitSingle() + bodyValue(body).awaitSingle() /** * Coroutines variant of [ServerResponse.BodyBuilder.body] with [Any] and diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/MultipartIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/MultipartIntegrationTests.java index 22c6f83079b..afabb433acc 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/MultipartIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/MultipartIntegrationTests.java @@ -63,7 +63,7 @@ class MultipartIntegrationTests extends AbstractRouterFunctionIntegrationTests { Mono result = webClient .post() .uri("http://localhost:" + this.port + "/multipartData") - .body(generateBody()) + .bodyValue(generateBody()) .exchange(); StepVerifier @@ -79,7 +79,7 @@ class MultipartIntegrationTests extends AbstractRouterFunctionIntegrationTests { Mono result = webClient .post() .uri("http://localhost:" + this.port + "/parts") - .body(generateBody()) + .bodyValue(generateBody()) .exchange(); StepVerifier @@ -95,7 +95,7 @@ class MultipartIntegrationTests extends AbstractRouterFunctionIntegrationTests { Mono result = webClient .post() .uri("http://localhost:" + this.port + "/transferTo") - .body(generateBody()) + .bodyValue(generateBody()) .retrieve() .bodyToMono(String.class); @@ -176,7 +176,7 @@ class MultipartIntegrationTests extends AbstractRouterFunctionIntegrationTests { Path tempFile = Files.createTempFile("MultipartIntegrationTests", null); return part.transferTo(tempFile) .then(ServerResponse.ok() - .body(tempFile.toString())); + .bodyValue(tempFile.toString())); } catch (Exception e) { return Mono.error(e); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/DefaultWebClientTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/DefaultWebClientTests.java index f2eae9e4ea6..c01384f958c 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/DefaultWebClientTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/DefaultWebClientTests.java @@ -186,7 +186,7 @@ public class DefaultWebClientTests { WebClient client = this.builder.build(); assertThatIllegalArgumentException().isThrownBy(() -> - client.post().uri("https://example.com").body(mono)); + client.post().uri("https://example.com").bodyValue(mono)); } @Test diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java index 41d9819969f..ebe88d6aa2c 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java @@ -514,7 +514,7 @@ class WebClientIntegrationTests { .uri("/pojo/capitalize") .accept(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON) - .body(new Pojo("foofoo", "barbar")) + .bodyValue(new Pojo("foofoo", "barbar")) .retrieve() .bodyToMono(Pojo.class); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilderTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilderTests.java index 708012f65a9..eb8640dea53 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilderTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilderTests.java @@ -309,7 +309,7 @@ public class DefaultServerResponseBuilderTests { public void copyCookies() { Mono serverResponse = ServerResponse.ok() .cookie(ResponseCookie.from("foo", "bar").build()) - .body("body"); + .bodyValue("body"); assertThat(serverResponse.block().cookies().isEmpty()).isFalse(); @@ -361,7 +361,7 @@ public class DefaultServerResponseBuilderTests { Mono mono = Mono.empty(); assertThatIllegalArgumentException().isThrownBy(() -> - ServerResponse.ok().body(mono)); + ServerResponse.ok().bodyValue(mono)); } @Test @@ -369,7 +369,7 @@ public class DefaultServerResponseBuilderTests { String etag = "\"foo\""; ServerResponse responseMono = ServerResponse.ok() .eTag(etag) - .body("bar") + .bodyValue("bar") .block(); MockServerHttpRequest request = MockServerHttpRequest.get("https://example.com") @@ -393,7 +393,7 @@ public class DefaultServerResponseBuilderTests { ServerResponse responseMono = ServerResponse.ok() .lastModified(oneMinuteBeforeNow) - .body("bar") + .bodyValue("bar") .block(); MockServerHttpRequest request = MockServerHttpRequest.get("https://example.com") diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/InvalidHttpMethodIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/InvalidHttpMethodIntegrationTests.java index 49bf19586dd..764792ab228 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/InvalidHttpMethodIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/InvalidHttpMethodIntegrationTests.java @@ -32,8 +32,8 @@ class InvalidHttpMethodIntegrationTests extends AbstractRouterFunctionIntegratio @Override protected RouterFunction routerFunction() { return RouterFunctions.route(RequestPredicates.GET("/"), - request -> ServerResponse.ok().body("FOO")) - .andRoute(RequestPredicates.all(), request -> ServerResponse.ok().body("BAR")); + request -> ServerResponse.ok().bodyValue("FOO")) + .andRoute(RequestPredicates.all(), request -> ServerResponse.ok().bodyValue("BAR")); } @ParameterizedHttpServerTest diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/NestedRouteIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/NestedRouteIntegrationTests.java index 75ab644f8fd..ca13675bb5e 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/NestedRouteIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/NestedRouteIntegrationTests.java @@ -137,7 +137,7 @@ class NestedRouteIntegrationTests extends AbstractRouterFunctionIntegrationTests public Mono pattern(ServerRequest request) { String pattern = matchingPattern(request).getPatternString(); - return ServerResponse.ok().body(pattern); + return ServerResponse.ok().bodyValue(pattern); } @SuppressWarnings("unchecked") diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MultipartIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MultipartIntegrationTests.java index dc5d9f58e18..a40d4767901 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MultipartIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MultipartIntegrationTests.java @@ -85,7 +85,7 @@ class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTests { Mono result = webClient .post() .uri("/requestPart") - .body(generateBody()) + .bodyValue(generateBody()) .exchange(); StepVerifier @@ -101,7 +101,7 @@ class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTests { Mono result = webClient .post() .uri("/requestBodyMap") - .body(generateBody()) + .bodyValue(generateBody()) .retrieve() .bodyToMono(String.class); @@ -117,7 +117,7 @@ class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTests { Mono result = webClient .post() .uri("/requestBodyFlux") - .body(generateBody()) + .bodyValue(generateBody()) .retrieve() .bodyToMono(String.class); @@ -133,7 +133,7 @@ class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTests { Mono result = webClient .post() .uri("/filePartFlux") - .body(generateBody()) + .bodyValue(generateBody()) .retrieve() .bodyToMono(String.class); @@ -149,7 +149,7 @@ class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTests { Mono result = webClient .post() .uri("/filePartMono") - .body(generateBody()) + .bodyValue(generateBody()) .retrieve() .bodyToMono(String.class); @@ -165,7 +165,7 @@ class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTests { Flux result = webClient .post() .uri("/transferTo") - .body(generateBody()) + .bodyValue(generateBody()) .retrieve() .bodyToFlux(String.class); @@ -183,7 +183,7 @@ class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTests { Mono result = webClient .post() .uri("/modelAttribute") - .body(generateBody()) + .bodyValue(generateBody()) .retrieve() .bodyToMono(String.class); diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensionsTests.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensionsTests.kt index 5db297834cf..5d54d81e7ce 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensionsTests.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensionsTests.kt @@ -67,12 +67,12 @@ class ServerResponseExtensionsTests { fun `BodyBuilder#bodyAndAwait with object parameter`() { val response = mockk() val body = "foo" - every { bodyBuilder.body(ofType()) } returns Mono.just(response) + every { bodyBuilder.bodyValue(ofType()) } returns Mono.just(response) runBlocking { bodyBuilder.bodyAndAwait(body) } verify { - bodyBuilder.body(ofType()) + bodyBuilder.bodyValue(ofType()) } }