Skip to content

Commit

Permalink
Fix ktor sessions plugin template missing @serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
bjhham committed Nov 19, 2024
1 parent 666895b commit b1c3a74
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
4 changes: 4 additions & 0 deletions plugins/server/io.ktor/ktor-sessions/2.0/MySession.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import kotlinx.serialization.Serializable

@Serializable
data class MySession(val count: Int = 0)
2 changes: 0 additions & 2 deletions plugins/server/io.ktor/ktor-sessions/2.0/install.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import io.ktor.server.application.*
import io.ktor.server.response.*
import io.ktor.server.sessions.*

public fun Application.configureSecurity() {
data class MySession(val count: Int = 0)
install(Sessions) {
cookie<MySession>("MY_SESSION") {
cookie.extensions["SameSite"] = "lax"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ prerequisites:
installation:
default: install.kt
in_routing: routing.kt
outside_app: MySession.kt
5 changes: 0 additions & 5 deletions plugins/server/io.ktor/ktor-sessions/2.0/routing.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import io.ktor.server.application.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
import io.ktor.server.sessions.*
import kotlinx.serialization.*

@Serializable
data class MySession(val count: Int = 0)

public fun Routing.configureRouting(mySession: MySession) {
get("/session/increment") {
Expand Down

0 comments on commit b1c3a74

Please sign in to comment.