mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Add Kemal::Context.get? to safely access context storage. Fixes #428
This commit is contained in:
parent
17bd3dce37
commit
4034dab952
2 changed files with 98 additions and 58 deletions
|
@ -10,7 +10,7 @@ class HTTP::Server
|
|||
|
||||
macro finished
|
||||
alias StoreTypes = Union({{ *STORE_MAPPINGS }})
|
||||
getter store = {} of String => StoreTypes
|
||||
@store = {} of String => StoreTypes
|
||||
end
|
||||
|
||||
def params
|
||||
|
@ -58,5 +58,9 @@ class HTTP::Server
|
|||
def set(name : String, value : StoreTypes)
|
||||
@store[name] = value
|
||||
end
|
||||
|
||||
def get?(name : String)
|
||||
@store[name]?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue