Asynchonous HTTP server, based on http-kit and core.async
Asynchonous HTTP server, based on http-kit and core.async
(handle-exceptions> handler>
&
{:keys [renderer logger]
:or {renderer basic-exception-renderer
logger server-error-exception-logger}})
(handle-head> handler>)
Middleware for handling HEAD requests in a way that doesn't break Compojure. This workarounds the logic in compojure.core/if-method that breaks when response is channel.
Middleware for handling HEAD requests in a way that doesn't break Compojure. This workarounds the logic in compojure.core/if-method that breaks when response is channel.
(json-api routes
&
{:keys [exception-logger exception-renderer logger]
:or {exception-logger server-error-exception-logger
exception-renderer json-exception-renderer
logger default-logger}})
(json-response> handler>)
Middleware that converts responses with a map or a vector for a body into a JSON response.
Middleware that converts responses with a map or a vector for a body into a JSON response.
(log-error-message ex)
Generate error message that will be written to log.
Generate error message that will be written to log.
(log-track-request> handler> & {:keys [logger] :or {logger default-logger}})
(response-error-message ex)
Generate error message that will be returned in response.
Generate error message that will be returned in response.
(wrap-content-type> handler)
(wrap-content-type> handler options)
Middleware that adds a content-type header to the response if one is not set by the handler. Uses the ring.util.mime-type/ext-mime-type function to guess the content-type from the file extension in the URI. If no content-type can be found, it defaults to 'application/octet-stream'.
Accepts the following options:
:mime-types - a map of filename extensions to mime-types that will be used in addition to the ones defined in ring.util.mime-types/default-mime-types
This is async version of wrap-content-type from ring.middleware.content-type: https://github.com/mmcgrana/ring/blob/master/ring-core/src/ring/middleware/content_type.clj Copyright (c) 2009-2010 Mark McGranaghan
Middleware that adds a content-type header to the response if one is not set by the handler. Uses the ring.util.mime-type/ext-mime-type function to guess the content-type from the file extension in the URI. If no content-type can be found, it defaults to 'application/octet-stream'. Accepts the following options: :mime-types - a map of filename extensions to mime-types that will be used in addition to the ones defined in ring.util.mime-types/default-mime-types This is async version of wrap-content-type from ring.middleware.content-type: https://github.com/mmcgrana/ring/blob/master/ring-core/src/ring/middleware/content_type.clj Copyright (c) 2009-2010 Mark McGranaghan
(wrap-cookies> handler)
(wrap-cookies> handler options)
Parses the cookies in the request map, then assocs the resulting map to the :cookies key on the request.
Accepts the following options:
:decoder - a function to decode the cookie value. Expects a function that takes a string and returns a string. Defaults to URL-decoding.
:encoder - a function to encode the cookie name and value. Expects a function that takes a name/value map and returns a string. Defaults to URL-encoding.
Each cookie is represented as a map, with its value being held in the :value key. A cookie may optionally contain a :path, :domain or :port attribute.
To set cookies, add a map to the :cookies key on the response. The values of the cookie map can either be strings, or maps containing the following keys:
:value - the new value of the cookie :path - the subpath the cookie is valid for :domain - the domain the cookie is valid for :max-age - the maximum age in seconds of the cookie :expires - a date string at which the cookie will expire :secure - set to true if the cookie requires HTTPS, prevent HTTP access :http-only - set to true if the cookie is valid for HTTP and HTTPS only (ie. prevent JavaScript access)
Parses the cookies in the request map, then assocs the resulting map to the :cookies key on the request. Accepts the following options: :decoder - a function to decode the cookie value. Expects a function that takes a string and returns a string. Defaults to URL-decoding. :encoder - a function to encode the cookie name and value. Expects a function that takes a name/value map and returns a string. Defaults to URL-encoding. Each cookie is represented as a map, with its value being held in the :value key. A cookie may optionally contain a :path, :domain or :port attribute. To set cookies, add a map to the :cookies key on the response. The values of the cookie map can either be strings, or maps containing the following keys: :value - the new value of the cookie :path - the subpath the cookie is valid for :domain - the domain the cookie is valid for :max-age - the maximum age in seconds of the cookie :expires - a date string at which the cookie will expire :secure - set to true if the cookie requires HTTPS, prevent HTTP access :http-only - set to true if the cookie is valid for HTTP and HTTPS only (ie. prevent JavaScript access)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close