Created
March 30, 2024 15:40
-
-
Save RaheemJnr/1ba740d5d21b097fb16f16a0ed1e0b23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun generalHttpClient(): HttpClient { | |
val client = | |
HttpClient(getClientEngine()) { | |
expectSuccess = true | |
install(Logging) { | |
logger = Logger.DEFAULT | |
level = LogLevel.ALL | |
logger = | |
object : Logger { | |
override fun log(message: String) { | |
println("HTTP Client: $message") | |
} | |
} | |
} | |
install(ContentNegotiation) { | |
json( | |
Json { | |
prettyPrint = true | |
isLenient = true | |
ignoreUnknownKeys = true | |
}, | |
) | |
} | |
defaultRequest { | |
contentType(ContentType.Application.Json) | |
url(BASE_URL) | |
} | |
} | |
authorizationIntercept(client) | |
return client | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment