https://kotlinlang.org logo
#ktor
Title
o

octylFractal

09/03/2018, 7:11 AM
Am I misunderstanding
HttpClient#config
? I expected that it would be equivalent to adding the given block to the end of the original
config
block, but it instead it overwrites it
d

Deactivated User

09/03/2018, 7:12 AM
what are you trying to do?
Have you noticed the
HttpClientConfig#engine
?
o

octylFractal

09/03/2018, 7:13 AM
I used
install
to add some features/interceptors, and I wanted to create another copy with those same features + additional custom interceptors
d

Deactivated User

09/03/2018, 7:13 AM
aha
o

octylFractal

09/03/2018, 7:14 AM
it doesn't work since the pipelines aren't copied over, but I don't know if that's intended or a bug
d

Deactivated User

09/03/2018, 7:15 AM
indeed, it seems that there is a bug, since the documentation states that it should copy the configuration
Copy code
fun config(block: HttpClientConfig<*>.() -> Unit): HttpClient = HttpClient(
        engine, useDefaultTransformers, HttpClientConfig<HttpClientEngineConfig>().apply(block)
    )
should probably be:
Copy code
fun config(block: HttpClientConfig<*>.() -> Unit): HttpClient = HttpClient(
        engine, useDefaultTransformers, config.clone().apply(block)
    )
o

octylFractal

09/03/2018, 7:16 AM
alright, should I file an issue / make a PR for this?
d

Deactivated User

09/03/2018, 7:17 AM
if you can, that would be nice, yeah 🙂 if you make a PR, please ensure to add a test that verifies the new behaviour
o

octylFractal

09/03/2018, 7:17 AM
I can do that, thanks for confirming the bug
👏 1
👍 2
4 Views