jean
HttpClient(CIO) { defaultRequest { url { host = "<https://my.host.com>" port = 443 } } install(JsonFeature) { serializer = GsonSerializer() } }
client.get<ApiResponse<Character>>("/endpoint")
private suspend fun get(path: String, parameters: Map<String, String>): SomeType { return client.get( scheme = "https", host = "<http://my.host.com|my.host.com>", port = 8080, path = path ) { addParameters(parameters) } }
get("my/path", parameters)
Nicolas Chevalier
protected fun HttpRequestBuilder.apiUrl(path: String) { url { takeFrom(baseUrl) encodedPath = path } }
val response: HttpResponse = <http://client.post|client.post> { apiUrl(path) addParameters(parameters) }
A modern programming language that makes developers happier.