Skip to content

druids/ring-headers-formatter

Repository files navigation

ring-headers-formatter

A Ring's middleware that converts response's headers into Title-Case and make sure that keys and values are strings."

CircleCI Dependencies Status License

Leiningen/Boot

[ring-headers-formatter "0.1.2"]

Documentation

Wrap your handlers into wrap-response-headers.

(require '[ring-headers-formatter.core :refer [wrap-response-headers]]
         '[ring.util.response :refer [response]])

(defn handler [request]
  {:response {:foo "bar"}, :headers {:x-limit 100}})

(def app
  (wrap-response-headers handler))

And response's headers will be formatted like this:

{:response {:foo "bar"}, :headers {"X-Limit" "100"}}

Please notice that lazy sequences in values aren't converted into strings, rather they passed as they are.

Contribution

Conventions

About

A Ring's middleware converts headers into Title-Case and returns keys/values as strings

Resources

License

Stars

Watchers

Forks

Packages

No packages published