Skip to content

Instantly share code, notes, and snippets.

@zaltoprofen
Created May 25, 2015 16:06
Show Gist options
  • Save zaltoprofen/e3524a5d39c912d081b2 to your computer and use it in GitHub Desktop.
Save zaltoprofen/e3524a5d39c912d081b2 to your computer and use it in GitHub Desktop.
private def request(charset: String)(f: => HttpUriRequest): Try[String] = Try {
val c = clientBuilder.build()
try {
val res = c.execute(f)
try {
EntityUtils.toString(res.getEntity, charset)
} finally {
HttpClientUtils.closeQuietly(res)
}
} finally {
HttpClientUtils.closeQuietly(c)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment