!htp #16088 replace RouteResult.Failure by Future.failed + handle post-processing directly in Directives
This replaces the awkward post-processing previously done with RequestContext.finish and prevents the loop-hole of Future.failed which previously allowed errors to be missed by the current ExceptionHandler.
This commit is contained in:
parent
0e06406e19
commit
4d0e1ba231
11 changed files with 110 additions and 151 deletions
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
package akka.http.server
|
||||
|
||||
import akka.http.model.HttpMethods._
|
||||
import akka.http.model
|
||||
import model.HttpMethods._
|
||||
import model.StatusCodes
|
||||
import akka.http.server.PathMatchers.{ Segment, IntNumber }
|
||||
|
||||
class BasicRouteSpecs extends RoutingSpec {
|
||||
|
|
@ -74,6 +76,23 @@ class BasicRouteSpecs extends RoutingSpec {
|
|||
} ~> check { responseAs[String] shouldEqual "The cat 84 The cat" }
|
||||
}
|
||||
}
|
||||
"Route disjunction" should {
|
||||
"work" in {
|
||||
val route = sealRoute((path("abc") | path("def")) {
|
||||
completeOk
|
||||
})
|
||||
|
||||
Get("/abc") ~> route ~> check {
|
||||
status shouldEqual StatusCodes.OK
|
||||
}
|
||||
Get("/def") ~> route ~> check {
|
||||
status shouldEqual StatusCodes.OK
|
||||
}
|
||||
Get("/ghi") ~> route ~> check {
|
||||
status shouldEqual StatusCodes.NotFound
|
||||
}
|
||||
}
|
||||
}
|
||||
"Case class extraction with Directive.as" should {
|
||||
"extract one argument" in {
|
||||
case class MyNumber(i: Int)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue