Rename body(Object) to bodyValue

The recently added body(Object) variant can be confused easily with
body(Publisher, Class) forgetting to provide the element type and
only running into the IllegalArgumentException at runtime.

See gh-23212
This commit is contained in:
Rossen Stoyanchev
2019-08-20 03:03:27 +03:00
parent 5cfe491602
commit 008687d5ae
24 changed files with 54 additions and 54 deletions

View File

@@ -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

View File

@@ -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);