!htc #16826 introduce HttpCookiePair for usage in Cookie-header
This commit is contained in:
parent
43cca877fe
commit
b2e6b650fd
15 changed files with 115 additions and 59 deletions
|
|
@ -15,7 +15,7 @@ class CookieDirectivesSpec extends RoutingSpec {
|
|||
|
||||
"The 'cookie' directive" should {
|
||||
"extract the respectively named cookie" in {
|
||||
Get() ~> addHeader(Cookie(HttpCookie("fancy", "pants"))) ~> {
|
||||
Get() ~> addHeader(Cookie("fancy" -> "pants")) ~> {
|
||||
cookie("fancy") { echoComplete }
|
||||
} ~> check { responseAs[String] shouldEqual "fancy=pants" }
|
||||
}
|
||||
|
|
@ -25,8 +25,8 @@ class CookieDirectivesSpec extends RoutingSpec {
|
|||
} ~> check { rejection shouldEqual MissingCookieRejection("fancy") }
|
||||
}
|
||||
"properly pass through inner rejections" in {
|
||||
Get() ~> addHeader(Cookie(HttpCookie("fancy", "pants"))) ~> {
|
||||
cookie("fancy") { c ⇒ reject(ValidationRejection("Dont like " + c.content)) }
|
||||
Get() ~> addHeader(Cookie("fancy" -> "pants")) ~> {
|
||||
cookie("fancy") { c ⇒ reject(ValidationRejection("Dont like " + c.value)) }
|
||||
} ~> check { rejection shouldEqual ValidationRejection("Dont like pants") }
|
||||
}
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ class CookieDirectivesSpec extends RoutingSpec {
|
|||
|
||||
"The 'optionalCookie' directive" should {
|
||||
"produce a `Some(cookie)` extraction if the cookie is present" in {
|
||||
Get() ~> Cookie(HttpCookie("abc", "123")) ~> {
|
||||
Get() ~> Cookie("abc" -> "123") ~> {
|
||||
optionalCookie("abc") { echoComplete }
|
||||
} ~> check { responseAs[String] shouldEqual "Some(abc=123)" }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue