This commit is contained in:
parent
5afb68cd59
commit
f98c1946d8
38 changed files with 914 additions and 52 deletions
|
|
@ -303,13 +303,11 @@ class BasicDirectivesExamplesSpec extends RoutingSpec {
|
|||
"mapRouteResult" in {
|
||||
//#mapRouteResult
|
||||
// this directive is a joke, don't do that :-)
|
||||
val makeEverythingOk = mapRouteResult { r =>
|
||||
r match {
|
||||
case Complete(response) =>
|
||||
// "Everything is OK!"
|
||||
Complete(response.copy(status = 200))
|
||||
case _ => r
|
||||
}
|
||||
val makeEverythingOk = mapRouteResult {
|
||||
case Complete(response) =>
|
||||
// "Everything is OK!"
|
||||
Complete(response.copy(status = 200))
|
||||
case r => r
|
||||
}
|
||||
|
||||
val route =
|
||||
|
|
@ -591,11 +589,9 @@ class BasicDirectivesExamplesSpec extends RoutingSpec {
|
|||
//#mapRouteResultWith-0
|
||||
case object MyCustomRejection extends Rejection
|
||||
val rejectRejections = // not particularly useful directive
|
||||
mapRouteResultWith { res =>
|
||||
res match {
|
||||
case Rejected(_) => Future(Rejected(List(AuthorizationFailedRejection)))
|
||||
case _ => Future(res)
|
||||
}
|
||||
mapRouteResultWith {
|
||||
case Rejected(_) => Future(Rejected(List(AuthorizationFailedRejection)))
|
||||
case res => Future(res)
|
||||
}
|
||||
val route =
|
||||
rejectRejections {
|
||||
|
|
@ -694,7 +690,7 @@ class BasicDirectivesExamplesSpec extends RoutingSpec {
|
|||
|
||||
// tests:
|
||||
Get("/") ~> route ~> check {
|
||||
responseAs[String] shouldEqual s"RoutingSettings.renderVanityFooter = true"
|
||||
responseAs[String] shouldEqual "RoutingSettings.renderVanityFooter = true"
|
||||
}
|
||||
//#
|
||||
}
|
||||
|
|
@ -767,7 +763,7 @@ class BasicDirectivesExamplesSpec extends RoutingSpec {
|
|||
pathPrefix("123") {
|
||||
ignoring456 {
|
||||
path("abc") {
|
||||
complete(s"Content")
|
||||
complete("Content")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue