cueball
09/25/2020, 4:24 AMreactive.function.client
method awaitBody()
from a Generic class and am running into error:
Kotlin: Cannot use 'Response' as reified type parameter. Use a class instead.
---
class ReactiveWebClient<Request: Any, Response: Any> {
suspend fun post(uri: URI, request: Request, headers: (HttpHeaders) -> Unit): Response {
return <http://webClient.post|webClient.post>()
.uri(uri)
.body(BodyInserters.fromValue(request))
.headers(headers)
.retrieve()
.awaitBody() // error on this line
}
}
Signature of `awaitBody`:
public suspend inline fun <reified T : kotlin.Any> org.springframework.web.reactive.function.client.WebClient.ResponseSpec.awaitBody(): T { /* compiled code */ }
Can someone please help? I’m not so well versed with Kotlin’s type parameters.
Slack Conversation