stch.response documentation
Generate Ring responses.
->EmptyResponse
(->EmptyResponse)
Positional factory function for class stch.response.EmptyResponse.
->Response
(->Response status headers body)
Positional factory function for class stch.response.Response.
->edn
(->edn data)
Inputs: [data]
Returns: Response
Returns an EDN encoded response.
->json
(->json data)
Inputs: [data]
Returns: Response
Returns a JSON encoded response.
IResponse
Generate type-specific Ring responses.
bad-request
(bad-request)
(bad-request text)
Inputs: [] [text :- String]
Returns: Response
Returns a 400 response.
code->text
Mapping of HTTP status codes to their default
descriptions.
ct-text-html
Header map with Content-Type set to text/html.
ct-text-plain
Header map with Content-Type set to text/plain.
empty-resp?
(empty-resp? x)
Inputs: [x :- Any]
Returns: Boolean
Is the object an instance of EmptyResponse?
forbidden
(forbidden)
(forbidden text)
Inputs: [] [text :- String]
Returns: Response
Returns a 403 response.
map->EmptyResponse
(map->EmptyResponse m__5818__auto__)
Factory function for class stch.response.EmptyResponse, taking a map of keywords to field values.
map->Response
(map->Response m2620)
Factory function for class Response, taking a map of keywords to field values, but not 400x slower than ->x like the clojure.core version
method-not-allowed
(method-not-allowed)
(method-not-allowed text)
Inputs: [] [text :- String]
Returns: Response
Returns a 405 response.
not-found
(not-found)
(not-found text)
Inputs: [] [text :- String]
Returns: Response
Returns a 404 response.
ok
(ok body)
(ok content-type body)
Inputs: [body :- String] [content-type :- String, body :- String]
Returns: Response
Returns a 200 response.
redirect
(redirect url)
Inputs: [url :- String]
Returns: Response
Returns a 302 response.
respond
(respond resp)
Returns a Ring response.
strict-map->Response
(strict-map->Response m2621 & [drop-extra-keys?__1737__auto__])
Factory function for class Response, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
text-response
(text-response code text)
Inputs: [code :- Int, text :- String]
Returns: Response
Returns a plain text response with the given status
code and body text.
trivial-response
(trivial-response code)
Inputs: [code :- Int]
Returns: Response
Returns a plain text response with the given status
code and the default description for the status code.