1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Warnings.

This commit is contained in:
Cedric Beust 2015-10-28 21:02:03 -07:00
parent 00e16eb2aa
commit eb623b7d9c

View file

@ -29,7 +29,7 @@ public class Http {
val response = client.newCall(request.build()).execute() val response = client.newCall(request.build()).execute()
return Body(response.body(), response.code()) return Body(response.body(), response.code())
} catch(ex: IOException) { } catch(ex: IOException) {
throw KobaltException("Could not load URL ${url}, error: " + ex.message, ex) throw KobaltException("Could not load URL $url, error: " + ex.message, ex)
} }
} }
@ -64,16 +64,16 @@ public class Http {
} }
} }
private val JSON = MediaType.parse("application/json; charset=utf-8") // private val JSON = MediaType.parse("application/json; charset=utf-8")
//
fun post(user: String?, password: String?, url: String, payload: String) : String { // fun post(user: String?, password: String?, url: String, payload: String) : String {
val request = builder(user, password) // val request = builder(user, password)
.url(url) // .url(url)
.post(RequestBody.create(JSON, payload)) // .post(RequestBody.create(JSON, payload))
.build() // .build()
val response = OkHttpClient().newCall(request).execute() // val response = OkHttpClient().newCall(request).execute()
return response.body().string() // return response.body().string()
} // }
} }
class KobaltException(s: String? = null, ex: Throwable? = null) : RuntimeException(s, ex) { class KobaltException(s: String? = null, ex: Throwable? = null) : RuntimeException(s, ex) {