Skip to content

Commit 7e9c33f

Browse files
committed
Polishing
See gh-34555
1 parent 00b88ec commit 7e9c33f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/WebClientExtensions.kt

+13-5
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ inline fun <reified T : Any> RequestBodySpec.bodyValueWithType(body: T): Request
9191
*/
9292
suspend fun <T: Any> RequestHeadersSpec<out RequestHeadersSpec<*>>.awaitExchange(responseHandler: suspend (ClientResponse) -> T): T {
9393
val context = currentCoroutineContext().minusKey(Job.Key)
94-
return withContext(context.toReactorContext()) { exchangeToMono { mono(context) { responseHandler.invoke(it) } }.awaitSingle() }
94+
return withContext(context.toReactorContext()) {
95+
exchangeToMono { mono(context) { responseHandler.invoke(it) } }.awaitSingle()
96+
}
9597
}
9698

9799
/**
@@ -101,7 +103,9 @@ suspend fun <T: Any> RequestHeadersSpec<out RequestHeadersSpec<*>>.awaitExchange
101103
*/
102104
suspend fun <T: Any> RequestHeadersSpec<out RequestHeadersSpec<*>>.awaitExchangeOrNull(responseHandler: suspend (ClientResponse) -> T?): T? {
103105
val context = currentCoroutineContext().minusKey(Job.Key)
104-
return withContext(context.toReactorContext()) { exchangeToMono { mono(context) { responseHandler.invoke(it) } }.awaitSingleOrNull() }
106+
return withContext(context.toReactorContext()) {
107+
exchangeToMono { mono(context) { responseHandler.invoke(it) } }.awaitSingleOrNull()
108+
}
105109
}
106110

107111
/**
@@ -183,7 +187,9 @@ suspend inline fun <reified T : Any> WebClient.ResponseSpec.awaitBodyOrNull() :
183187
*/
184188
suspend fun WebClient.ResponseSpec.awaitBodilessEntity(): ResponseEntity<Void> {
185189
val context = currentCoroutineContext().minusKey(Job.Key)
186-
return withContext(context.toReactorContext()) { toBodilessEntity().awaitSingle() }
190+
return withContext(context.toReactorContext()) {
191+
toBodilessEntity().awaitSingle()
192+
}
187193
}
188194

189195
/**
@@ -222,11 +228,13 @@ inline fun <reified T : Any> WebClient.ResponseSpec.toEntityFlux(): Mono<Respons
222228
* propagation to the [CoExchangeFilterFunction]. This extension is not subject to type erasure
223229
* and retains actual generic type arguments.
224230
*
225-
* @since 7.0.0
231+
* @since 7.0
226232
*/
227233
suspend inline fun <reified T : Any> WebClient.ResponseSpec.awaitEntity(): ResponseEntity<T> {
228234
val context = currentCoroutineContext().minusKey(Job.Key)
229-
return withContext(context.toReactorContext()) { toEntity(T::class.java).awaitSingle() }
235+
return withContext(context.toReactorContext()) {
236+
toEntity(T::class.java).awaitSingle()
237+
}
230238
}
231239

232240
@PublishedApi

0 commit comments

Comments
 (0)