Reduce cookie size
This commit is contained in:
@@ -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"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user