lmug-response
Manipulating responses.
content-type/2
(resp content-type)
Returns an updated Ring response with the a Content-Type header
corresponding to the given content-type.
get-header/2
(resp ())
(resp header-key (when (is_atom header-key)))
(resp header-key)
Looks up a header in a Ring response (or request) case insensitively,
returning the value of the header, or nil if not present.
header/3
(resp header-key header-value)
Returns an updated Ring response with the specified header added.
match-header/2
(headers header-key)
Return the first header that matches the given header-key.
match-headers/2
(headers sought-key)
Return all the headers that match the given header-key.
response/0
Create a default response suitable for use as an lmug handler. As this
function takes no arguments, it cannot be used in the middle of a
middleware chain, only at the beginning.
Returns a function which expects an lmug request as the only argument.
response/1
(_handler)
Create a default response suitable for use as an lmug handler. This
function takes one argument (though it is ignored), and as such it can be
used in the middle of a middleware chain.
Note that the intended use for this function is to override the response
generated in the lmug middleware chain up until that point. As such, you
should almost never need to use this function directly.
Returns a function which expects an lmug request as the only argument.
response/2
(_handler opts)
Create a default response suitable for use as an lmug handler. This
function takes two arguments (the first, the handler, is ignored). The second
argument is for options (proplist).
Allowed options are:
status: HTTP response status number (e.g., 200)headers: HTTP response headersbody: HTTP response body
This function may be used in the middle of a middleware chain. Note, however,
that the intended use for this function is to override the response
generated in the lmug middleware chain up until that point. As such, you
should almost never need to use this function directly.
Returns a function which expects an lmug request as the only argument.