OptionalMultiQueryParamDecoderMatcher
org.http4s.dsl.impl.OptionalMultiQueryParamDecoderMatcher
abstract class OptionalMultiQueryParamDecoderMatcher[T](name: String)(implicit evidence$1: QueryParamDecoder[T])
Capture a query parameter that appears 0 or more times.
case class Foo(i: Int)
implicit val fooDecoder: QueryParamDecoder[Foo] = ...
implicit val fooParam: QueryParam[Foo] = ...
object FooMatcher extends OptionalMultiQueryParamDecoderMatcher[Foo]("foo")
val routes = HttpRoutes.of {
// matches http://.../closest?foo=2&foo=3&foo=4
case GET -> Root / "closest" :? FooMatcher(Validated.Valid(Seq(Foo(2),Foo(3),Foo(4)))) => ...
/*
* matches http://.../closest?foo=2&foo=3&foo=4 as well as http://.../closest (no parameters)
* or http://.../closest?foo=2 (single occurrence)
*/
case GET -> Root / "closest" :? FooMatcher(is) => ...
Attributes
- Source
- Path.scala
- Graph
-
- Supertypes
Members list
In this article