Skip to content

Instantly share code, notes, and snippets.

@arturaz
Created October 31, 2012 17:00
Show Gist options
  • Save arturaz/3988297 to your computer and use it in GitHub Desktop.
Save arturaz/3988297 to your computer and use it in GitHub Desktop.
package helpers.action
import play.api.mvc._
trait ActionComposition {
def Action[A](bodyParser: BodyParser[A])(
block: Request[A] => Result
): Action[A] = play.api.mvc.Action(bodyParser)(block)
def Action(block: Request[AnyContent] => Result): Action[AnyContent] =
Action(BodyParsers.parse.anyContent)(block)
def Action(block: => Result): Action[AnyContent] =
Action((request) => block)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment