The Sessions plugin for Ktor describe it can be used for things like "storing a logged-in user's ID," for which the name of the cookie itself and a value should be enough. But every example uses several key-value pairs taken from data classes. Is it possible to have a type of cookie from Sessions that only has a name and a value, without keys?
Copy code
data class MyCookie(val text: String)
// ...
cookie<MyCookie>("cookie") {
this results in a cookie named
cookie
with the value
text%3D%2523sHello
instead of just
cookie
and
Hello
.
h
hfhbd
09/11/2023, 6:09 AM
Use a value class
➕ 1
👍 1
m
Manuel Pérez Alcolea
11/02/2023, 10:51 PM
mmm I'm getting the same result. I guess it's not possible