Asynchronous HTTP Client - Clojure - Requesting API
Asynchronous HTTP Client - Clojure - Requesting API
(body-collect state baos)
(body-completed _)
(convert-action action)
Converts action (:abort, nil) to Async client STATE.
Converts action (:abort, nil) to Async client STATE.
(error-collect _ t)
(execute-request client
req
&
{status :status
headers :headers
part :part
completed :completed
error :error})
Executes provided request. Arguments:
Returns a map:
Executes provided request. Arguments: - req - request to be executed - :status - status callback (optional, defaults to status-collect) - :headers - headers callback (optional, defaults to headers-collect) - :part - body part callback (optional, defaults to body-collect) - :completed - response completed (optional, defaults to body-completed) - :error - error callback (optional, defaults to error-collect) Returns a map: - :id - unique ID of request - :status - promise that once status is received is delivered, contains lazy map of: - :code - response code - :msg - response message - :protocol - protocol with version - :major - major version of protocol - :minor - minor version of protocol - :headers - promise that once headers are received is delivered, contains lazy map of: - :server - header names are keyworded, values stay not changed - :body - body of response, depends on request type, might be ByteArrayOutputStream or lazy sequence, use conveniece methods to extract it, like string - :done - promise that is delivered once receiving response has finished - :error - promise that is delivered if requesting resource failed, once delivered will contain Throwable.
(get-encoding {ct :content-type :or {ct ""}})
Gets content encoding from headers, if Content-Type header not present or media-type in it is missing => nil
Gets content encoding from headers, if Content-Type header not present or media-type in it is missing => nil
(headers-collect _ headers)
Reurns all headers, or aborts if no headers provided.
Reurns all headers, or aborts if no headers provided.
(prepare-request method
url
&
{:keys [headers query body cookies proxy auth timeout]})
Prepares method (GET, POST, ..) request to url. Options: :query - map of query parameters, if value is vector than multiple values will be send as n=v1&n=v2 :headers - map of headers :body - body :cookies - cookies to send :proxy - map with proxy configuration to be used :host - proxy host :port - proxy port :protocol - (optional) protocol to communicate with proxy, :http (default, if you provide no value) and :https are allowed :user - (optional) user name to use for proxy authentication, has to be provided with :password :password - (optional) password to use for proxy authentication, has to be provided with :user :auth - map with authentication to be used :type - either :basic or :digest :user - user name to be used :password - password to be used :realm - realm name to authenticate in :preemptive - assume authentication is required :timeout - request timeout in ms
Prepares method (GET, POST, ..) request to url. Options: :query - map of query parameters, if value is vector than multiple values will be send as n=v1&n=v2 :headers - map of headers :body - body :cookies - cookies to send :proxy - map with proxy configuration to be used :host - proxy host :port - proxy port :protocol - (optional) protocol to communicate with proxy, :http (default, if you provide no value) and :https are allowed :user - (optional) user name to use for proxy authentication, has to be provided with :password :password - (optional) password to use for proxy authentication, has to be provided with :user :auth - map with authentication to be used :type - either :basic or :digest :user - user name to be used :password - password to be used :realm - realm name to authenticate in :preemptive - assume authentication is required :timeout - request timeout in ms
(status-collect _ status)
Returns all status and procides with execution
Returns all status and procides with execution
(url-encode arg)
Taken from Clojure Http Client
Taken from Clojure Http Client
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close