Skip to content

Commit 40a55b4

Browse files
committed
Rename BodyBuilder#bodyAndAwait to bodyValueAndAwait
1 parent 73f5d05 commit 40a55b4

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensions.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ inline fun <reified T : Any> ServerResponse.BodyBuilder.body(producer: Any): Mon
5050
body(producer, object : ParameterizedTypeReference<T>() {})
5151

5252
/**
53-
* Coroutines variant of [ServerResponse.BodyBuilder.body] with an [Any] parameter.
53+
* Coroutines variant of [ServerResponse.BodyBuilder.bodyValue].
5454
*
5555
* Set the body of the response to the given {@code Object} and return it.
5656
* This convenience method combines [body] and
@@ -60,7 +60,7 @@ inline fun <reified T : Any> ServerResponse.BodyBuilder.body(producer: Any): Mon
6060
* @throws IllegalArgumentException if `body` is a [Publisher] or an
6161
* instance of a type supported by [org.springframework.core.ReactiveAdapterRegistry.getSharedInstance],
6262
*/
63-
suspend fun ServerResponse.BodyBuilder.bodyAndAwait(body: Any): ServerResponse =
63+
suspend fun ServerResponse.BodyBuilder.bodyValueAndAwait(body: Any): ServerResponse =
6464
bodyValue(body).awaitSingle()
6565

6666
/**

spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/ServerResponseExtensionsTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class ServerResponseExtensionsTests {
6969
val body = "foo"
7070
every { bodyBuilder.bodyValue(ofType<String>()) } returns Mono.just(response)
7171
runBlocking {
72-
bodyBuilder.bodyAndAwait(body)
72+
bodyBuilder.bodyValueAndAwait(body)
7373
}
7474
verify {
7575
bodyBuilder.bodyValue(ofType<String>())

src/docs/asciidoc/web/webflux-functional.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ found. If it is not found, we use `switchIfEmpty(Mono<T>)` to return a 404 Not F
351351
352352
suspend fun getPerson(request: ServerRequest): ServerResponse { // <3>
353353
val personId = request.pathVariable("id").toInt()
354-
return repository.getPerson(personId)?.let { ok().contentType(APPLICATION_JSON).bodyAndAwait(it) }
354+
return repository.getPerson(personId)?.let { ok().contentType(APPLICATION_JSON).bodyValueAndAwait(it) }
355355
?: ServerResponse.notFound().buildAndAwait()
356356
357357
}
@@ -477,7 +477,7 @@ header:
477477
----
478478
val route = coRouter {
479479
(GET("/hello-world") and accept(MediaType.TEXT_PLAIN)).invoke {
480-
ServerResponse.ok().bodyAndAwait("Hello World")
480+
ServerResponse.ok().bodyValueAndAwait("Hello World")
481481
}
482482
}
483483
----

0 commit comments

Comments
 (0)