Hamza
HttpClient().use { client -> val response = client.submitForm<HttpResponse>( url = "<https://discord.com/api/oauth2/token>", formParameters = Parameters.build { append("client_id", config.discord.client) append("client_secret", config.discord.secret) append("grant_type", "authorization_code") append("redirect_uri", config.discord.redirect) append("scope", "identify") append("code", code) }) println(response.readText()) // throws an error if response status is not 200. }
andev
val client = HttpClient{ expectSuccess = false }
A modern programming language that makes developers happier.