Reduce cookie size

This commit is contained in:
2020-08-22 17:46:32 +02:00
parent eeae982a71
commit 5573dd45d6
6 changed files with 17 additions and 17 deletions
@@ -51,7 +51,7 @@ internal class AuthFilterTest {
@Test
fun `it should allow an invalid token`() {
val response = app(Request(GET, "/optional").cookie("Authorization", "Bearer nnkjnkjnk"))
val response = app(Request(GET, "/optional").cookie("Bearer", "nnkjnkjnk"))
assertThat(response, hasStatus(OK))
assertThat(response, hasBody("null"))
}
@@ -60,7 +60,7 @@ internal class AuthFilterTest {
fun `it should allow a valid token`() {
val jwtPayload = JwtPayload(1, "user")
val token = simpleJwt.sign(jwtPayload)
val response = app(Request(GET, "/optional").cookie("Authorization", "Bearer $token"))
val response = app(Request(GET, "/optional").cookie("Bearer", token))
assertThat(response, hasStatus(OK))
assertThat(response, hasBody("$jwtPayload"))
}
@@ -77,7 +77,7 @@ internal class AuthFilterTest {
@Test
fun `it shouldn't allow an invalid token`() {
val response = app(Request(GET, "/protected").cookie("Authorization", "Bearer nnkjnkjnk"))
val response = app(Request(GET, "/protected").cookie("Bearer", "nnkjnkjnk"))
assertThat(response, hasStatus(FOUND))
assertThat(response, hasHeader("Location"))
}
@@ -86,7 +86,7 @@ internal class AuthFilterTest {
fun `it should allow a valid token"`() {
val jwtPayload = JwtPayload(1, "user")
val token = simpleJwt.sign(jwtPayload)
val response = app(Request(GET, "/protected").cookie("Authorization", "Bearer $token"))
val response = app(Request(GET, "/protected").cookie("Bearer", token))
assertThat(response, hasStatus(OK))
assertThat(response, hasBody("$jwtPayload"))
}