Skip to content
weavejester edited this page Aug 7, 2011 · 12 revisions

The ring.util.response namespace contains functions for creating Ring response maps (see Concepts).

The response function creates a basic "200 OK" response:

(response "Hello World")

=> {:status 200
    :headers {}
    :body "Hello World"}

One can then use functions like content-type to alter the base response to add in additional headers and other components:

(-> (response "Hello World")
    (content-type "text/plain"))

=> {:status 200
    :headers {"Content-Type" "text/plain"}
    :body "Hello World"}
Clone this wiki locally