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:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user