Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit 0f7f570

Browse files
committed
revert propsed fix; added new test
1 parent ec1bf46 commit 0f7f570

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

core/src/main/scala/com/softwaremill/session/SessionDirectives.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ trait RefreshableSessionDirectives { this: OneOffSessionDirectives =>
172172
onSuccess(sc.refreshTokenManager.sessionFromValue(v))
173173
.flatMap {
174174
case s @ SessionResult.CreatedFromToken(session) =>
175-
setRefreshToken(sc, setSt, session) & provide(s: SessionResult[T])
175+
setRefreshableSession(sc, setSt, session) & provide(s: SessionResult[T])
176176
case s => provide(s)
177177
}
178178
}

core/src/test/scala/com/softwaremill/session/RefreshableTest.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,23 @@ class RefreshableTest extends FlatSpec with ScalatestRouteTest with Matchers wit
106106
}
107107
}
108108

109+
p should "set a new session after the session is re-created" in {
110+
Get("/set") ~> routes ~> check {
111+
val Some(token1) = using.getRefreshToken
112+
val session1 = using.getSession
113+
session1 should be('defined)
114+
115+
Get("/getOpt") ~>
116+
addHeader(using.setRefreshTokenHeader(token1)) ~>
117+
routes ~>
118+
check {
119+
val session2 = using.getSession
120+
session2 should be('defined)
121+
session2 should not be (session1)
122+
}
123+
}
124+
}
125+
109126
p should "read an optional session when none is set" in {
110127
Get("/getOpt") ~> routes ~> check {
111128
responseAs[String] should be("None")

0 commit comments

Comments
 (0)