scalaunfiltered

Intent that extracts parameters and enforces GET using Unfiltered


Unfiltered offers an easy way to specify routes.

case GET(Path("/ask")) =>

It also offers an easy way to extract parameters.

case Params(params) =>

What if I want to do both? What is good style for this? I realize I could:

  1. use case req @ GET(Path("/ask")) and use req.parameterValues
  2. match a second time on req
  3. call Params.unapply directly

What should I do?


Solution

  • You can use & like

    case GET(UFPath("/int") & Params(params)) =>
    

    See ParamsSpec.scala#L38.