This middleware is adapted from clj-http, whose license is amenable to this sort of copy/pastery
This middleware is adapted from clj-http, whose license is amenable to this sort of copy/pastery
(handle-redirects client req rsp)
Middleware that follows redirects in the response. A slingshot exception is thrown if too many redirects occur. Options:
:follow-redirects - default:true, whether to follow redirects :max-redirects - default:20, maximum number of redirects to follow :force-redirects - default:false, force redirecting methods to GET requests
In the response: :redirects-count - number of redirects :trace-redirects - vector of sites the request was redirected from
Middleware that follows redirects in the response. A slingshot exception is thrown if too many redirects occur. Options: :follow-redirects - default:true, whether to follow redirects :max-redirects - default:20, maximum number of redirects to follow :force-redirects - default:false, force redirecting methods to GET requests In the response: :redirects-count - number of redirects :trace-redirects - vector of sites the request was redirected from
(wrap-accept {:keys [accept] :as req})
Middleware converting the :accept key in a request to application/<type>
Middleware converting the :accept key in a request to application/<type>
(wrap-accept-encoding {:keys [accept-encoding] :as req})
Middleware converting the :accept-encoding option to an acceptable Accept-Encoding header in the request.
Middleware converting the :accept-encoding option to an acceptable Accept-Encoding header in the request.
(wrap-basic-auth req)
Middleware converting the :basic-auth option into an Authorization header.
Middleware converting the :basic-auth option into an Authorization header.
(wrap-content-type {:keys [content-type character-encoding] :as req})
Middleware converting a :content-type <keyword>
option to the formal
application/<name> format and adding it as a header.
Middleware converting a `:content-type <keyword>` option to the formal application/<name> format and adding it as a header.
(wrap-cookies {:keys [cookie-store cookie-spec cookies]
:or {cookie-spec default-cookie-spec cookies (quote ())}
:as req})
Middleware that set 'Cookie' header based on the content of cookies passed with the request or from cookies storage (when provided). Source for 'Cookie' header content by priorities:
:cookies
:cookie-store
Each cookie should be represented as a map:
|:---|:---
| name
| name of this cookie
| value
| value of this cookie
| domain
| specifies allowed hosts to receive the cookie (including subdomains)
| path
| indicates a URL path that must exist in the requested URL in order to send the 'Cookie' header
| http-only?
| when set to true
, cookie can only be accessed by HTTP. Optional, defaults to false
| secure?
| when set to true
, cookie can only be transmitted over an encrypted connection. Optional, defaults to false
| max-age
| set maximum age of this cookie in seconds. Options, defaults to io.netty.handler.codec.http.cookie.Cookie/UNDEFINED_MAX_AGE
.
Middleware that set 'Cookie' header based on the content of cookies passed with the request or from cookies storage (when provided). Source for 'Cookie' header content by priorities: * 'Cookie' header (already set) * non-empty `:cookies` * non-nil `:cookie-store` Each cookie should be represented as a map: |:---|:--- | `name` | name of this cookie | `value` | value of this cookie | `domain` | specifies allowed hosts to receive the cookie (including subdomains) | `path` | indicates a URL path that must exist in the requested URL in order to send the 'Cookie' header | `http-only?` | when set to `true`, cookie can only be accessed by HTTP. Optional, defaults to `false` | `secure?` | when set to `true`, cookie can only be transmitted over an encrypted connection. Optional, defaults to `false` | `max-age` | set maximum age of this cookie in seconds. Options, defaults to `io.netty.handler.codec.http.cookie.Cookie/UNDEFINED_MAX_AGE`.
(wrap-exceptions client)
Middleware that throws response as an ExceptionInfo if the response has unsuccessful status code. :throw-exceptions set to false in the request disables this middleware.
Middleware that throws response as an ExceptionInfo if the response has unsuccessful status code. :throw-exceptions set to false in the request disables this middleware.
(wrap-form-params {:keys [form-params content-type request-method]
:or {content-type :x-www-form-urlencoded}
:as req})
Middleware wrapping the submission or form parameters.
Middleware wrapping the submission or form parameters.
(wrap-method req)
Middleware converting the :method option into the :request-method option
Middleware converting the :method option into the :request-method option
(wrap-nested-params {:keys [content-type flatten-nested-keys] :as req})
Middleware wrapping nested parameters for query strings.
Middleware wrapping nested parameters for query strings.
(wrap-oauth req)
Middleware converting the :oauth-token option into an Authorization header.
Middleware converting the :oauth-token option into an Authorization header.
(wrap-query-params {:keys [query-params content-type multi-param-style]
:or {content-type :x-www-form-urlencoded
multi-param-style :default}
:as req})
Middleware converting the :query-params option to a querystring on the request.
Middleware converting the :query-params option to a querystring on the request.
(wrap-request client)
Returns a batteries-included HTTP request function corresponding to the given core client. See default-middleware for the middleware wrappers that are used by default
Returns a batteries-included HTTP request function corresponding to the given core client. See default-middleware for the middleware wrappers that are used by default
(wrap-request-timing client)
Middleware that times the request, putting the total time (in milliseconds) of the request into the :request-time key in the response.
Middleware that times the request, putting the total time (in milliseconds) of the request into the :request-time key in the response.
(wrap-url req)
Middleware wrapping request URL parsing.
Middleware wrapping request URL parsing.
(wrap-user-info req)
Middleware converting the :user-info option into a :basic-auth option
Middleware converting the :user-info option into a :basic-auth option
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close