Rename ServerResponse.BodyBuilder.body to syncBody
This commit renames the `body(Object)` on ServerResponse to `syncBody(Object)`. The reason for this is that the original method name clashed with the `body(Publisher)` method in the Kotlin extension. The new name nicely reflects the synchronous nature of the method, making it less appealing than the `Publisher`-based `body` method. Issue: SPR-15467
This commit is contained in:
@@ -274,7 +274,7 @@ class DefaultWebTestClient implements WebTestClient {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> RequestHeadersSpec<?> body(BodyInserter<T, ? super ClientHttpRequest> inserter) {
|
||||
public RequestHeadersSpec<?> body(BodyInserter<?, ? super ClientHttpRequest> inserter) {
|
||||
this.bodySpec.body(inserter);
|
||||
return this;
|
||||
}
|
||||
@@ -286,8 +286,8 @@ class DefaultWebTestClient implements WebTestClient {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> RequestHeadersSpec<?> body(T body) {
|
||||
this.bodySpec.body(body);
|
||||
public RequestHeadersSpec<?> syncBody(Object body) {
|
||||
this.bodySpec.syncBody(body);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -458,14 +458,13 @@ public interface WebTestClient {
|
||||
/**
|
||||
* Set the body of the request to the given {@code BodyInserter}.
|
||||
* @param inserter the inserter
|
||||
* @param <T> the body type or the element type (for a stream)
|
||||
* @return spec for decoding the response
|
||||
* @see org.springframework.web.reactive.function.BodyInserters
|
||||
*/
|
||||
<T> RequestHeadersSpec<?> body(BodyInserter<T, ? super ClientHttpRequest> inserter);
|
||||
RequestHeadersSpec<?> body(BodyInserter<?, ? super ClientHttpRequest> inserter);
|
||||
|
||||
/**
|
||||
* Set the body of the request to the given {@code Publisher}.
|
||||
* Set the body of the request to the given asynchronous {@code Publisher}.
|
||||
* @param publisher the request body data
|
||||
* @param elementClass the class of elements contained in the publisher
|
||||
* @param <T> the type of the elements contained in the publisher
|
||||
@@ -475,13 +474,12 @@ public interface WebTestClient {
|
||||
<T, S extends Publisher<T>> RequestHeadersSpec<?> body(S publisher, Class<T> elementClass);
|
||||
|
||||
/**
|
||||
* Set the body of the request to the given {@code Object} and
|
||||
* Set the body of the request to the given synchronous {@code Object} and
|
||||
* perform the request.
|
||||
* @param body the {@code Object} to write to the request
|
||||
* @param <T> the type contained in the body
|
||||
* @return a {@code Mono} with the response
|
||||
*/
|
||||
<T> RequestHeadersSpec<?> body(T body);
|
||||
RequestHeadersSpec<?> syncBody(Object body);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user