Base.Dict
— TypeDict([itr])
Dict{K,V}()
constructs a hash table with keys of type K
and values of type V
. Keys are compared with isequal
and hashed with hash
.
Given a single iterable argument, constructs a Dict
whose key-value pairs are taken from 2-tuples (key,value)
generated by the argument.
Examples
julia> Dict([("A", 1), ("B", 2)])
Dict{String, Int64} with 2 entries:
"B" => 2
"A" => 1
Alternatively, a sequence of pair arguments may be passed.
julia> Dict("A"=>1, "B"=>2)
Dict{String, Int64} with 2 entries:
"B" => 2
"A" => 1
Genie.Cookies.get
— Functionget(payload::Union{HTTP.Response,HTTP.Request}, key::Union{String,Symbol}, default::T; encrypted::Bool = true)::T where T
Attempts to get the Cookie value stored at key
within payload
. If the key
is not set, the default
value is returned.
Arguments
payload::Union{HTTP.Response,HTTP.Request}
: the request or response object containing the Cookie headerskey::Union{String,Symbol}
: the name of the cookie valuedefault::T
: default value to be returned if no cookie value is set atkey
encrypted::Bool
: iftrue
the value stored on the cookie is automatically decrypted
get(res::HTTP.Response, key::Union{String,Symbol}) :: Union{Nothing,String}
Retrieves a value stored on the cookie as key
from the Respose
object.
Arguments
payload::Union{HTTP.Response,HTTP.Request}
: the request or response object containing the Cookie headerskey::Union{String,Symbol}
: the name of the cookie valueencrypted::Bool
: iftrue
the value stored on the cookie is automatically decrypted
get(req::Request, key::Union{String,Symbol}) :: Union{Nothing,String}
Retrieves a value stored on the cookie as key
from the Request
object.
Arguments
req::HTTP.Request
: the request or response object containing the Cookie headerskey::Union{String,Symbol}
: the name of the cookie valueencrypted::Bool
: iftrue
the value stored on the cookie is automatically decrypted
Genie.Cookies.getcookies
— Functiongetcookies(req::HTTP.Request) :: Vector{HTTP.Cookies.Cookie}
Extracts cookies from within req
getcookies(req::HTTP.Request) :: Vector{HTTP.Cookies.Cookie}
Extracts cookies from within req
, filtering them by matching
name.
Genie.Cookies.set!
— Functionset!(res::HTTP.Response, key::Union{String,Symbol}, value::Any, attributes::Dict; encrypted::Bool = true) :: HTTP.Response
Sets value
under the key
label on the Cookie
.
Arguments
res::HTTP.Response
: the HTTP.Response objectkey::Union{String,Symbol}
: the key for storing the cookie valuevalue::Any
: the cookie valueattributes::Dict
: additional cookie attributes, such aspath
,httponly
,maxage
encrypted::Bool
: iftrue
the value is stored encoded
Genie.Cookies.nullablevalue
— Functionnullablevalue(payload::Union{HTTP.Response,HTTP.Request}, key::Union{String,Symbol}; encrypted::Bool = true)
Attempts to retrieve a cookie value stored at key
in the payload object
and returns a Union{Nothing,String}
Arguments
payload::Union{HTTP.Response,HTTP.Request}
: the request or response object containing the Cookie headerskey::Union{String,Symbol}
: the name of the cookie valueencrypted::Bool
: iftrue
the value stored on the cookie is automatically decrypted