parameterMultiMap

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.

Signature

def parameterMultiMap: Directive[Map[String, List[String]] :: HNil] 

Description

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? for other choices.

Example

val route =
  parameterMultiMap { params =>
    complete(s"There are parameters ${params.map(x => x._1+" -> "+x._2.size).mkString(", ")}")
  }

Get("/?color=blue&count=42") ~> route ~> check {
  responseAs[String] === "There are parameters color -> 1, count -> 1"
}
Get("/?x=23&x=42") ~> route ~> check {
  responseAs[String] === "There are parameters x -> 2"
}