Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Standard Library

weavejester edited this page · 2 revisions

Responses

The ring.util.response namespace contains functions for generating responses. This can make your handlers more concise and understandable.

In the last section the following example was used:

(defn what-is-my-ip [request]
  {:status 200
   :headers {"Content-Type" "text/plain"}
   :body (:remote-addr request)})

But by using the ring.util.response namespace, the function can be written:

(defn what-is-my-ip [request]
  (-> (response (:remote-addr request))
      (content-type "text/plain")))

Content Type

TODO

Parameters

File Uploads

URL-encoded parameters handle normal form data, but if you want to upload files, you'll need multipart-encoded parameters. This functionality can be added to your handler with the wrap-multipart-params middleware.

ring.middleware.multipart-params/wrap-multipart-params

(wrap-multipart-params handler)
(wrap-multipart-params handler options)

The options for this middleware function are:

  • :encoding The character encoding of the parameters. Acts the same as the same option in wrap-params.

  • :store A function to use to store the uploaded files. There are two stores included with Ring.

Multipart stores are covered in a later section.

Cookies

TODO

Sessions

TODO

Something went wrong with that request. Please try again.