This patch was authored and released by @Mordil.
As reported by #2480, right now SessionData
is a public type without much use to developers to write middleware, algorithms, etc. on top of due to how strongly the storage is encapsulated.
SessionData
has been changed as follows:
- Now conforms to
Equatable
andExpressibleByDictionaryLiteral
- A new
snapshot
computed property is available to get a copy of its storage init(_:)
is now deprecated in favor ofinit(initialData:)
let data: SessionData = ["name": "Vapor"]
// creates a copy of the data as of this point
let snapshot = data.snapshot
client.storeUsingDictionary(snapshot)