parameterMultiMap
Signature
Description
Extracts all parameters at once as a multi-map of type Map[String, List[String]
mapping
a parameter name to a list of all its values.
This directive can be used if parameters can occur several times.
The order of values is not specified.
See When to use which parameter directive? to understand when to use which directive.
Example
val route =
parameterMultiMap { params =>
complete(s"There are parameters ${params.map(x => x._1 + " -> " + x._2.size).mkString(", ")}")
}
// tests:
Get("/?color=blue&count=42") ~> route ~> check {
responseAs[String] shouldEqual "There are parameters color -> 1, count -> 1"
}
Get("/?x=23&x=42") ~> route ~> check {
responseAs[String] shouldEqual "There are parameters x -> 2"
}
Contents