I'm making a library that wraps a REST API using K...
# ktor
z
I'm making a library that wraps a REST API using Ktor and I'm wondering what the best design would be for the client class that developers create. Specifically I'm wondering on how I should construct the ktor Http client. I've read that having multiple clients can have negative effects on performance, but passing in a custom http client brings the chance of issues cause it requires the content negotiation to be installed with json setup correctly. So I'm kinda stuck unsure how to proceed
s
Ktor separates the HttpClient from the HttpClientEngine. Broadly speaking, I think the HttpClient has all the plugins and configuration, while the engine holds shared resources like threads and connection pools. So perhaps you could allow the user to pass in and reuse an existing engine, but use that engine to create and configure your own client.