Skip to content

Instantly share code, notes, and snippets.

@s1monw1
Created September 15, 2022 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s1monw1/f29b265e649d87b1eebf49f87824d0b8 to your computer and use it in GitHub Desktop.
Save s1monw1/f29b265e649d87b1eebf49f87824d0b8 to your computer and use it in GitHub Desktop.
private fun requestContributor(name: String): Contributor {
val contributors =
with(client) {
val response =
Request.Builder().url(ENDPOINT).build().let { newCall(it).execute() }
val responseAsString = response.use {
it.body()?.source()?.readByteArray()?.let { String(it) }
?: throw IllegalStateException("No response from server!")
}
responseAsString.let {
LOG.debug("response from git api: $it\n")
mapper.readValue(it)
}
}
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment