Skip to content

Instantly share code, notes, and snippets.

@jestan
Created October 27, 2011 13:30
Show Gist options
  • Save jestan/1319535 to your computer and use it in GitHub Desktop.
Save jestan/1319535 to your computer and use it in GitHub Desktop.
Dispatch Http Verbs
import dispatch._
import Http._
val http = new Http with thread.Safety with NoLogging
val host = :/("localhost", 8080)
//GET
val resp = http(host / "feed-api" / "app1" / "status" as_str)
//POST
def extractResp(json: String) = { /*... */ }
val resp = http(host / "feed-api" / "subscribe" / "app1"
<< (""" { "userId" : 12233 } """, "application/json")
>- { extractResp(_)})
@jestan
Copy link
Author

jestan commented Nov 6, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment