Skip to content

Instantly share code, notes, and snippets.

@gakuzzzz
Created June 24, 2015 08:06
Show Gist options
  • Save gakuzzzz/7031497c4da514db5982 to your computer and use it in GitHub Desktop.
Save gakuzzzz/7031497c4da514db5982 to your computer and use it in GitHub Desktop.
def doAction6 = Action { implicit req =>
(for {
_ <- authorizeHeaders(req.headers) \/> BadRequest("Unauthorized request")
json <- req.body.asJson \/> BadRequest("Wrong POST body")
user <- validateJson(json) \/> BadRequest("Invalid JSON")
} yield {
doSomething(user)
Ok("Success")
}).merge
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment