defaults to here in case there are multiple engines in the classpath. To do this without an unchecked cast, the engine also needs to be provided by a consumer. But overall that’s a dangerous looking pattern in
API
m
MV
05/04/2024, 5:28 PM
Yes, I wanted to avoid that, I have made them typed for each target. But it is still a unchecked cast
Copy code
fun API.setDefaultClientConfig(block: HttpClientConfig<OkHttpConfig>.() -> Unit){
@Suppress("UNCHECKED_CAST")
defaultClient = defaultClient.config(block as HttpClientConfig<*>.() -> Unit)
}