cancelAllRejections
Cancels all rejections created by the inner route for which the condition argument function returns true
.
Signature
def cancelAllRejections(cancelFilter: Rejection ⇒ Boolean): Directive0
Description
Use the cancelRejection
to cancel a specific rejection instance.
Example
def isMethodRejection: Rejection => Boolean = {
case MethodRejection(_) => true
case _ => false
}
val route =
cancelAllRejections(isMethodRejection) {
post {
complete("Result")
}
}
Get("/") ~> route ~> check {
rejections === Nil
handled === false
}