How do you configure timeouts on the ktor http cli...
# ktor
r
How do you configure timeouts on the ktor http client?
c
You can setup timeouts in client's config or use standard corountine's function
withTimeout(...) {    }
r
What client config?
I don't see how I can pass a
ApacheEngineConfig
to
HttpClient
c
Copy code
val client = HttpClient(Apache.config { 
            connectTimeout = ...
            connectTimeout = ...
            connectionRequestTimeout = ...
        })
r
Thanks
c
// cc @Deactivated User it would be nice to mention it in the docs
r
IDEA does not autocomplete
Apache
with
.config
so there is no chance to discover this without docs
d
Sure, @cy already in the preliminary documentation (not merged yet)
👍🏻 1
c
@ribesg it does, you just need to include
ktor-client-apache
to get it working
d
Gael, have you tried
this.
to see the available properties/methods? Or was a matter of discovering
Apache.config
itself?
r
No, IDEA does not suggest
.config
after typing
Apache
Oh, it does if I write it somewhere else
c
Perhaps it does but it is not in the top and not bold so it's not so easy to pay attention to it
Or may be it wasn't work with older kotlin plugins (?)
d
The page about the HttpClient is now live: http://ktor.io/clients/http-client.html And you can find information about Engine.config here: http://ktor.io/clients/http-client.html#engines Ping me if you find something that is missing, incomplete or that is hard to understand.