Skip to content

Commit 8ddceff

Browse files
committed
Replace Convert.ChangeType to unbox in StateStore.get
1 parent 5f1ae47 commit 8ddceff

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Suave/State.fs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,11 @@ module CookieStateStore =
9393
let private createStateStore (serialiser : CookieSerialiser) (userState : Map<string, obj>) (ss : obj) =
9494
{ new StateStore with
9595
member x.get key =
96-
serialiser.deserialise (ss :?> byte []) |> Map.tryFind key
97-
|> Option.map (fun x -> Convert.ChangeType(x, typeof<'T>) :?> 'T)
96+
ss
97+
:?> byte []
98+
|> serialiser.deserialise
99+
|> Map.tryFind key
100+
|> Option.map unbox
98101
member x.set key value =
99102
let expiry = userState |> Map.find (StateStoreType + "-expiry") :?> CookieLife
100103
write expiry key value

0 commit comments

Comments
 (0)