Permalink
Browse files

! routing: small improvement of `require` and `hrequire` modifiers on…

… directives
  • Loading branch information...
sirthias committed Aug 23, 2013
1 parent f713565 commit 9c1122842d6b1155ad2d323e9d41cb40ba81a78b
Showing with 4 additions and 4 deletions.
  1. +4 −4 spray-routing/src/main/scala/spray/routing/Directive.scala
@@ -86,10 +86,10 @@ abstract class Directive[L <: HList] { self ⇒
def happly(g: R Route) = self.happly { values f(values).happly(g) }
}
- def hrequire(predicate: L Boolean, rejection: Option[Rejection] = None): Directive0 =
+ def hrequire(predicate: L Boolean, rejections: Rejection*): Directive0 =
new Directive0 {
def happly(f: HNil Route) =
- self.happly { values ctx if (predicate(values)) f(HNil)(ctx) else ctx.reject(rejection.toList: _*) }
+ self.happly { values ctx if (predicate(values)) f(HNil)(ctx) else ctx.reject(rejections: _*) }
}
def recover[R >: L <: HList](recovery: List[Rejection] Directive[R]): Directive[R] =
@@ -130,7 +130,7 @@ object Directive {
def flatMap[R <: HList](f: T Directive[R]): Directive[R] =
underlying.hflatMap { case value :: HNil f(value) }
- def require(predicate: T Boolean, rejection: Option[Rejection] = None): Directive0 =
- underlying.hrequire({ case value :: HNil predicate(value) }, rejection)
+ def require(predicate: T Boolean, rejections: Rejection*): Directive0 =
+ underlying.hrequire({ case value :: HNil predicate(value) }, rejections: _*)
}
}

0 comments on commit 9c11228

Please sign in to comment.