Ktorfit icon indicating copy to clipboard operation
Ktorfit copied to clipboard

Document how to use custom Ktor client

Open mattrob33 opened this issue 2 years ago • 1 comments

The docs mention

Ktorfit doesn’t parse JSON. You have to install the Json Feature to the Ktor Client that you add to Ktorfit

but never explain how to use your own Ktor client.

mattrob33 avatar Apr 17 '22 10:04 mattrob33

@mattrob33 Just provide your own client in the constructor

Ktorfit(baseUrl = "url", httpClient = HttpClient {
    install(ContentNegotiation) {
        json(Json {
            prettyPrint = true
            isLenient = true
            ignoreUnknownKeys = true
        })
    }
})

enq3 avatar Jun 21 '22 12:06 enq3

Sorry, for the very late reaction. I finally added it to the documentation https://foso.github.io/Ktorfit/configuration/#add-your-own-ktor-client

Foso avatar Mar 02 '23 21:03 Foso