Skip to content

Instantly share code, notes, and snippets.

@alibahaaa
Created June 25, 2022 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alibahaaa/61bde8d2e6c0ea853176d839309033bf to your computer and use it in GitHub Desktop.
Save alibahaaa/61bde8d2e6c0ea853176d839309033bf to your computer and use it in GitHub Desktop.
import io.ktor.client.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.serialization.kotlinx.json.*
import kotlinx.serialization.json.Json
fun createJson() = Json { isLenient = true; ignoreUnknownKeys = true }
fun createHttpClient(
json: Json
) = HttpClient {
install(ContentNegotiation) {
json(json)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment