Skip to content

Instantly share code, notes, and snippets.

@sudowork
Created February 19, 2013 09:12
Show Gist options
  • Select an option

  • Save sudowork/4984249 to your computer and use it in GitHub Desktop.

Select an option

Save sudowork/4984249 to your computer and use it in GitHub Desktop.
def query[T](target: String, params: Seq[(String, String)])(fromRespStr: String => T): (Int, Option[T]) = {
executer x (:/(host, port) / target <<? params >:> identity) {
case (200, _, Some(entity), _) => {
val respBodyStr = fromInputStream(entity.getContent()).getLines.mkString
(200, Some(fromRespStr(respBodyStr)))
}
case (status, _, _, _) => (status, None)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment