!htp consistently prefix simple extraction directives with extract

This commit is contained in:
Johannes Rudolph 2014-10-28 14:33:26 +01:00
parent 1a8f4381d8
commit 85ca3e6853
11 changed files with 33 additions and 33 deletions

View file

@ -7,10 +7,10 @@ package directives
class BasicDirectivesSpec extends RoutingSpec {
"The `rewriteUnmatchedPath` directive" should {
"rewrite the unmatched path" in {
"The `mapUnmatchedPath` directive" should {
"map the unmatched path" in {
Get("/abc") ~> {
rewriteUnmatchedPath(_ / "def") {
mapUnmatchedPath(_ / "def") {
path("abc" / "def") { completeOk }
}
} ~> check { response shouldEqual Ok }

View file

@ -13,20 +13,20 @@ import Uri._
class MiscDirectivesSpec extends RoutingSpec {
"the clientIP directive" should {
"the extractClientIP directive" should {
"extract from a X-Forwarded-For header" in {
Get() ~> addHeaders(`X-Forwarded-For`("2.3.4.5"), RawHeader("x-real-ip", "1.2.3.4")) ~> {
clientIP { echoComplete }
extractClientIP { echoComplete }
} ~> check { responseAs[String] shouldEqual "2.3.4.5" }
}
"extract from a Remote-Address header" in {
Get() ~> addHeaders(RawHeader("x-real-ip", "1.2.3.4"), `Remote-Address`(RemoteAddress("5.6.7.8"))) ~> {
clientIP { echoComplete }
extractClientIP { echoComplete }
} ~> check { responseAs[String] shouldEqual "5.6.7.8" }
}
"extract from a X-Real-IP header" in {
Get() ~> addHeader(RawHeader("x-real-ip", "1.2.3.4")) ~> {
clientIP { echoComplete }
extractClientIP { echoComplete }
} ~> check { responseAs[String] shouldEqual "1.2.3.4" }
}
}

View file

@ -7,7 +7,7 @@ package akka.http.server.directives
import akka.http.server._
class PathDirectivesSpec extends RoutingSpec {
val echoUnmatchedPath = unmatchedPath { echoComplete }
val echoUnmatchedPath = extractUnmatchedPath { echoComplete }
def echoCaptureAndUnmatchedPath[T]: T Route =
capture ctx ctx.complete(capture.toString + ":" + ctx.unmatchedPath)

View file

@ -8,9 +8,9 @@ package directives
import akka.http.model.StatusCodes._
class SchemeDirectivesSpec extends RoutingSpec {
"the schemeName directive" should {
"the extractScheme directive" should {
"extract the Uri scheme" in {
Put("http://localhost/", "Hello") ~> schemeName { echoComplete } ~> check { responseAs[String] shouldEqual "http" }
Put("http://localhost/", "Hello") ~> extractScheme { echoComplete } ~> check { responseAs[String] shouldEqual "http" }
}
}