Genie.Requests.jsonpayloadFunction
jsonpayload()

Processes an application/json POST request. If it fails to successfully parse the JSON data it returns nothing. The original payload can still be accessed invoking rawpayload()

source
jsonpayload(::Type{T}) where {T}

Processes an application/json POST request attempting to convert the payload into a value of type T. If it fails to successfully parse and convert the JSON data, it throws an exception. The original payload can still be accessed invoking rawpayload()

source
Genie.Requests.filespayloadFunction
filespayload() :: Dict{String,HttpFile}

Collection of form uploaded files.

source
filespayload(filename::Union{String,Symbol}) :: HttpFile

Returns the HttpFile uploaded through the key input name.

source
Genie.Requests.infilespayloadFunction
infilespayload(key::Union{String,Symbol}) :: Bool

Checks if the collection of uploaded files contains a file stored under the key name.

source
Base.writeFunction
write(io::IO, x)
write(filename::AbstractString, x)

Write the canonical binary representation of a value to the given I/O stream or file. Return the number of bytes written into the stream. See also print to write a text representation (with an encoding that may depend upon io).

You can write multiple values with the same write call. i.e. the following are equivalent:

write(io, x, y...)
write(io, x) + write(io, y...)

Examples

julia> io = IOBuffer();

julia> write(io, "JuliaLang is a GitHub organization.", " It has many members.")
56

julia> String(take!(io))
"JuliaLang is a GitHub organization. It has many members."

julia> write(io, "Sometimes those members") + write(io, " write documentation.")
44

julia> String(take!(io))
"Sometimes those members write documentation."

User-defined plain-data types without write methods can be written when wrapped in a Ref:

julia> struct MyStruct; x::Float64; end

julia> io = IOBuffer()
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1)

julia> write(io, Ref(MyStruct(42.0)))
8

julia> seekstart(io); read!(io, Ref(MyStruct(NaN)))
Base.RefValue{MyStruct}(MyStruct(42.0))
source
Base.readFunction
read(io::IO, T)

Read a single value of type T from io, in canonical binary representation.

read(io::IO, String)

Read the entirety of io, as a String.

Examples

julia> io = IOBuffer("JuliaLang is a GitHub organization");

julia> read(io, Char)
'J': ASCII/Unicode U+004A (category Lu: Letter, uppercase)

julia> io = IOBuffer("JuliaLang is a GitHub organization");

julia> read(io, String)
"JuliaLang is a GitHub organization"
source
read(filename::AbstractString, args...)

Open a file and read its contents. args is passed to read: this is equivalent to open(io->read(io, args...), filename).

read(filename::AbstractString, String)

Read the entire contents of a file as a string.

source
read(s::IO, nb=typemax(Int))

Read at most nb bytes from s, returning a Vector{UInt8} of the bytes read.

source
read(s::IOStream, nb::Integer; all=true)

Read at most nb bytes from s, returning a Vector{UInt8} of the bytes read.

If all is true (the default), this function will block repeatedly trying to read all requested bytes, until an error or end-of-file occurs. If all is false, at most one read call is performed, and the amount of data returned is device-dependent. Note that not all stream types support the all option.

source
read(command::Cmd)

Run command and return the resulting output as an array of bytes.

source
read(command::Cmd, String)

Run command and return the resulting output as a String.

source
read(file::HttpFile)

Returns the content of file as string.

source
Genie.Requests.postpayloadFunction
postpayload() :: Dict{Symbol,Any}

A dict representing the POST variables payload of the request (corresponding to a form-data request)

source
postpayload(key::Symbol) :: Any

Returns the value of the POST variables key.

source
postpayload(key::Symbol, default::Any)

Returns the value of the POST variables key or the default value if key is not defined.

source
Genie.Requests.getpayloadFunction
getpayload() :: Dict{Symbol,Any}

A dict representing the GET/query variables payload of the request (the part correspoding to ?foo=bar&baz=moo)

source
getpayload(key::Symbol) :: Any

The value of the GET/query variable key, as in ?key=value

source
getpayload(key::Symbol, default::Any) :: Any

The value of the GET/query variable key, as in ?key=value. If key is not defined, default is returned.

source
Genie.Requests.payloadFunction
payload() :: Any

Utility function for accessing the @params collection, which holds the request variables.

source
payload(key::Symbol) :: Any

Utility function for accessing the key value within the @params collection of request variables.

source
payload(key::Symbol, default_value::T) :: Any

Utility function for accessing the key value within the @params collection of request variables. If key is not defined, default_value is returned.

source