Skip to content

Instantly share code, notes, and snippets.

@mariusk
Created July 31, 2015 14:42
Show Gist options
  • Save mariusk/82ba6c1dd85483805513 to your computer and use it in GitHub Desktop.
Save mariusk/82ba6c1dd85483805513 to your computer and use it in GitHub Desktop.
fun post(url :String, json :JSONObject) : Promise<JSONObject> {
return Promise.async(Callable<JSONObject> {
val response: Response = this.postJson(url, json)
if (!response.isSuccessful())
throw IOException(response.toString())
val str = response.body().string()
return JSONObject(str)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment