parameterSeq

Extracts all parameters at once in the original order as (name, value) tuples of type (String, String).

Signature

def parameterSeq: Directive[Seq[(String, String)] :: HNil] 

Description

This directive can be used if the exact order of parameters is important or if parameters can occur several times.

See When to use which parameter directive? for other choices.

Example

val route =
  parameterSeq { params =>
    def paramString(param: (String, String)): String = s"""${param._1} = '${param._2}'"""
    complete(s"The parameters are ${params.map(paramString).mkString(", ")}")
  }

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