Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ class HttpCookieSpec extends AnyFreeSpec with Matchers {
Optional.of(SameSite.Lax)).getSameSite must be(Optional.of(SameSite.Lax))
}
}
"reject invalid arguments" - {
"non-token cookie name" in {
val error = the[IllegalArgumentException] thrownBy HttpCookie.create(" ", "dark")
error.getMessage must include("not allowed in cookie name")
}
"semicolon in a cookie value" in {
val error = the[IllegalArgumentException] thrownBy HttpCookie.create("theme", ";")
error.getMessage must include("not allowed in cookie content")
}
}
"SameSite conversation to Scala" - {
"convert Strict" in {
SameSite.Strict.asScala() must be(sh.SameSite.Strict)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,23 @@ class HeaderSpec extends AnyFreeSpec with Matchers {
}
}
}
"HttpCookie factories should" - {
"retain an ordinary name and value" in {
val cookie = HttpCookie("theme", "dark")
cookie.name shouldEqual "theme"
cookie.value shouldEqual "dark"
}

"reject a non-token cookie name" in {
val error = the[IllegalArgumentException] thrownBy HttpCookie(" ", "dark")
error.getMessage should include("not allowed in cookie name")
}

"reject a semicolon in a cookie value" in {
val error = the[IllegalArgumentException] thrownBy HttpCookie("theme", ";")
error.getMessage should include("not allowed in cookie content")
}
}
"RawHeader should" - {
"check for valid arguments" - {
"successful parse run" in {
Expand Down