Response helpers adapted from ring-core/util/response.clj
Response helpers adapted from ring-core/util/response.clj
(bad-request body)
Returns a 400 'bad request' response.
Returns a 400 'bad request' response.
(charset resp ?charset)
Returns an updated response with the supplied charset added to the Content-Type header.
Returns an updated response with the supplied charset added to the Content-Type header.
(content-type resp ?content-type)
Returns an updated response with the a Content-Type header corresponding to the given content-type.
Returns an updated response with the a Content-Type header corresponding to the given content-type.
(created url)
(created url body)
Returns a response for a HTTP 201 created response.
Returns a response for a HTTP 201 created response.
(find-header resp header-name)
Looks up a header in a response (or request) case insensitively, returning the header map entry, or nil if not present.
Looks up a header in a response (or request) case insensitively, returning the header map entry, or nil if not present.
(get-header resp header-name)
Looks up a header in a response (or request) case insensitively, returning the value of the header, or nil if not present.
Looks up a header in a response (or request) case insensitively, returning the value of the header, or nil if not present.
(header resp ?name value)
Returns an updated response with the specified header added.
Returns an updated response with the specified header added.
(json body)
Returns a skeletal response with the given body, status of 200, and Content-Type
set to application/json
.
Returns a skeletal response with the given body, status of 200, and `Content-Type` set to `application/json`.
(not-found body)
Returns a 404 'not found' response.
Returns a 404 'not found' response.
(redirect url)
(redirect url status)
Returns a response for an HTTP 302 redirect. Status may be a key in redirect-status-codes or a numeric code. Defaults to 302
Returns a response for an HTTP 302 redirect. Status may be a key in redirect-status-codes or a numeric code. Defaults to 302
Map a keyword to a redirect status code.
Map a keyword to a redirect status code.
(response body)
Returns a skeletal response with the given body, status of 200, and no headers.
Returns a skeletal response with the given body, status of 200, and no headers.
(set-cookie resp {:keys [k v] :as opts})
Sets a cookie on the response.
Sets a cookie on the response.
(status ?status)
(status resp ?status)
Returns an updated response with the given status.
Returns an updated response with the given status.
(text ?msg)
Returns a skeletal response with the given msg, status of 200, and Content-Type
set to text/plain
.
Returns a skeletal response with the given msg, status of 200, and `Content-Type` set to `text/plain`.
(update-header resp header-name f & args)
Looks up a header in a response (or request) case insensitively, then updates the header with the supplied function and arguments in the manner of update-in.
Looks up a header in a response (or request) case insensitively, then updates the header with the supplied function and arguments in the manner of update-in.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close