Genie.Cookies.getFunction
get(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 headers
  • key::Union{String,Symbol}: the name of the cookie value
  • default::T: default value to be returned if no cookie value is set at key
  • encrypted::Bool: if true 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 headers
  • key::Union{String,Symbol}: the name of the cookie value
  • encrypted::Bool: if true 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 headers
  • key::Union{String,Symbol}: the name of the cookie value
  • encrypted::Bool: if true the value stored on the cookie is automatically decrypted
Genie.Cookies.set!Function
set!(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 object
  • key::Union{String,Symbol}: the key for storing the cookie value
  • value::Any: the cookie value
  • attributes::Dict: additional cookie attributes, such as Path or HttpOnly
  • encrypted::Bool: if true the value is stored encoded
Base.DictType
Dict([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
source
Genie.Cookies.nullablevalueFunction
nullablevalue(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 headers
  • key::Union{String,Symbol}: the name of the cookie value
  • encrypted::Bool: if true the value stored on the cookie is automatically decrypted
Genie.Cookies.getcookiesFunction
getcookies(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.