Closed windbird123 closed 3 years ago
@windbird123
the output gives the hint: params are nested as tuples to the left and you need to match them as such:
import trail._
val details = Root / "details" & Param[String]("engine") & Param[String]("device") & Param[String]("query")
val s = "/details?engine=google&device=mobile&query=covid19&fourth=4"
s match {
case details((engine, device), query) =>
println(s"params: $engine, $device, $query")
case _ =>
}
params: google, mobile, covid19
if you would add a fourth:
case details(((engine, device), query), fourth)
@adrobisch thank you.
compile error when 3 or more params
Result:
And if I change the code like below
Result: