Liking cljdoc? Tell your friends :D

org.httpkit.client


aclclj

(acl url & [opts callback])
(acl url & [callback])

Issues an async HTTP ACL request. See request for details.

Issues an async HTTP ACL request. See `request` for details.
raw docstring

copyclj

(copy url & [opts callback])
(copy url & [callback])

Issues an async HTTP COPY request. See request for details.

Issues an async HTTP COPY request. See `request` for details.
raw docstring

default-clientclj


default-poolclj


deleteclj

(delete url & [opts callback])
(delete url & [callback])

Issues an async HTTP DELETE request. See request for details.

Issues an async HTTP DELETE request. See `request` for details.
raw docstring

getclj

(get url & [opts callback])
(get url & [callback])

Issues an async HTTP GET request. See request for details.

Issues an async HTTP GET request. See `request` for details.
raw docstring

(head url & [opts callback])
(head url & [callback])

Issues an async HTTP HEAD request. See request for details.

Issues an async HTTP HEAD request. See `request` for details.
raw docstring

lockclj

(lock url & [opts callback])
(lock url & [callback])

Issues an async HTTP LOCK request. See request for details.

Issues an async HTTP LOCK request. See `request` for details.
raw docstring

max-body-filterclj

(max-body-filter size)

reject if response's body exceeds size in bytes

reject if response's body exceeds size in bytes
raw docstring

moveclj

(move url & [opts callback])
(move url & [callback])

Issues an async HTTP MOVE request. See request for details.

Issues an async HTTP MOVE request. See `request` for details.
raw docstring

optionsclj

(options url & [opts callback])
(options url & [callback])

Issues an async HTTP OPTIONS request. See request for details.

Issues an async HTTP OPTIONS request. See `request` for details.
raw docstring

patchclj

(patch url & [opts callback])
(patch url & [callback])

Issues an async HTTP PATCH request. See request for details.

Issues an async HTTP PATCH request. See `request` for details.
raw docstring

postclj

(post url & [opts callback])
(post url & [callback])

Issues an async HTTP POST request. See request for details.

Issues an async HTTP POST request. See `request` for details.
raw docstring

propfindclj

(propfind url & [opts callback])
(propfind url & [callback])

Issues an async HTTP PROPFIND request. See request for details.

Issues an async HTTP PROPFIND request. See `request` for details.
raw docstring

proppatchclj

(proppatch url & [opts callback])
(proppatch url & [callback])

Issues an async HTTP PROPPATCH request. See request for details.

Issues an async HTTP PROPPATCH request. See `request` for details.
raw docstring

putclj

(put url & [opts callback])
(put url & [callback])

Issues an async HTTP PUT request. See request for details.

Issues an async HTTP PUT request. See `request` for details.
raw docstring

reportclj

(report url & [opts callback])
(report url & [callback])

Issues an async HTTP REPORT request. See request for details.

Issues an async HTTP REPORT request. See `request` for details.
raw docstring

requestclj

(request {:keys [client timeout filter worker-pool keepalive as follow-redirects
                 max-redirects response]
          :as opts
          :or {timeout 60000
               response (promise)
               follow-redirects true
               as :auto
               client (clojure.core/deref default-client)
               worker-pool default-pool
               max-redirects 10
               keepalive 120000
               filter IFilter/ACCEPT_ALL}}
         &
         [callback])

Issues an async HTTP request and returns a promise object to which the value of (callback {:opts _ :status _ :headers _ :body _}) or (callback {:opts _ :error _}) will be delivered.

When unspecified, callback is the identity

;; Asynchronous GET request (returns a promise) (request {:url "http://www.cnn.com"})

;; Asynchronous GET request with callback (request {:url "http://www.cnn.com" :method :get} (fn [{:keys [opts status body headers error] :as resp}] (if error (println "Error on" opts) (println "Success on" opts))))

;; Synchronous requests @(request ...) or (deref (request ...) timeout-ms timeout-val)

;; Issue 2 concurrent requests, then wait for results (let [resp1 (request ...) resp2 (request ...)] (println "resp1's status: " (:status @resp1)) (println "resp2's status: " (:status @resp2)))

Output coercion: ;; Return the body as a byte stream (request {:url "http://site.com/favicon.ico" :as :stream}) ;; Coerce as a byte-array (request {:url "http://site.com/favicon.ico" :as :byte-array}) ;; return the body as a string body (request {:url "http://site.com/string.txt" :as :text}) ;; Try to automatically coerce the output based on the content-type header, currently supports :text :stream, (with automatic charset detection) (request {:url "http://site.com/string.txt" :as :auto})

Request options: :url :method :headers :timeout :query-params :form-params :as :client :body :basic-auth :user-agent :filter :worker-pool

Issues an async HTTP request and returns a promise object to which the value
of `(callback {:opts _ :status _ :headers _ :body _})` or
   `(callback {:opts _ :error _})` will be delivered.

When unspecified, `callback` is the identity

;; Asynchronous GET request (returns a promise)
(request {:url "http://www.cnn.com"})

;; Asynchronous GET request with callback
(request {:url "http://www.cnn.com" :method :get}
  (fn [{:keys [opts status body headers error] :as resp}]
    (if error
      (println "Error on" opts)
      (println "Success on" opts))))

;; Synchronous requests
@(request ...) or (deref (request ...) timeout-ms timeout-val)

;; Issue 2 concurrent requests, then wait for results
(let [resp1 (request ...)
      resp2 (request ...)]
  (println "resp1's status: " (:status @resp1))
  (println "resp2's status: " (:status @resp2)))

Output coercion:
;; Return the body as a byte stream
(request {:url "http://site.com/favicon.ico" :as :stream})
;; Coerce as a byte-array
(request {:url "http://site.com/favicon.ico" :as :byte-array})
;; return the body as a string body
(request {:url "http://site.com/string.txt" :as :text})
;; Try to automatically coerce the output based on the content-type header, currently supports :text :stream, (with automatic charset detection)
(request {:url "http://site.com/string.txt" :as :auto})

Request options:
  :url :method :headers :timeout :query-params :form-params :as
  :client :body :basic-auth :user-agent :filter :worker-pool
raw docstring

unlockclj

(unlock url & [opts callback])
(unlock url & [callback])

Issues an async HTTP UNLOCK request. See request for details.

Issues an async HTTP UNLOCK request. See `request` for details.
raw docstring

url-encodeclj

(url-encode s)

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close