Liking cljdoc? Tell your friends :D

babashka.http-client


->Authenticatorclj

(->Authenticator opts)

Constructs a java.net.Authenticator.

Options:

  • :user: the username
  • :pass: the password
Constructs a `java.net.Authenticator`.

Options:

* `:user`: the username
* `:pass`: the password
raw docstring

->ProxySelectorclj

(->ProxySelector opts)

Constructs a java.net.ProxySelector. Options:

  • :host, string
  • :port, long
Constructs a `java.net.ProxySelector`.
Options:
* `:host`, string
* `:port`, long
raw docstring

->SSLContextclj

(->SSLContext opts)

Constructs a javax.net.ssl.SSLContext.

Options:

  • :key-store is a file, URI or URL or anything else that is compatible with io/input-stream, e.g. (io/resource somepath.p12)
  • :key-store-pass is the password for the keystore
  • :key-store-type is the type of keystore to create [note: not the type of the file] (default: pkcs12)
  • :trust-store is a file, URI or URL or anything else that is compatible with io/input-stream, e.g. (io/resource somepath.p12)
  • :trust-store-pass is the password for the trust store
  • :trust-store-type is the type of trust store to create [note: not the type of the file] (default: pkcs12)
  • :insecure if true, an insecure trust manager accepting all server certificates will be configured.

Note that :keystore and :truststore can be set using the javax.net.ssl.keyStore and javax.net.ssl.trustStore System properties globally.

Constructs a `javax.net.ssl.SSLContext`.

Options:

* `:key-store` is a file, URI or URL or anything else that is compatible with `io/input-stream`, e.g. (io/resource somepath.p12)
* `:key-store-pass` is the password for the keystore
* `:key-store-type` is the type of keystore to create [note: not the type of the file] (default: pkcs12)
* `:trust-store` is a file, URI or URL or anything else that is compatible with `io/input-stream`, e.g. (io/resource somepath.p12)
* `:trust-store-pass` is the password for the trust store
* `:trust-store-type` is the type of trust store to create [note: not the type of the file] (default: pkcs12)
* `:insecure` if `true`, an insecure trust manager accepting all server certificates will be configured.

Note that `:keystore` and `:truststore` can be set using the
`javax.net.ssl.keyStore` and `javax.net.ssl.trustStore` System
properties globally.
raw docstring

clientclj

(client opts)

Construct a custom client. To get the same behavior as the (implicit) default client, pass default-client-opts.

Options:

  • :follow-redirects - :never, :always or :normal
  • :connect-timeout - connection timeout in milliseconds.
  • :request - default request options which will be used in requests made with this client.
  • :executor - a java.util.concurrent.Executor
  • :ssl-context: a javax.net.ssl.SSLContext or a map of options, see docstring of ->SSLContext
  • :proxy: a java.net.ProxySelector or a map of options, see docstring of ->ProxySelector
  • :authenticator: a java.net.Authenticator or a map of options, see docstring of ->Authenticator.

Returns map with:

  • :client, a java.net.http.HttpClient.

The map can be passed to request via the :client key.

Construct a custom client. To get the same behavior as the (implicit) default client, pass `default-client-opts`.

Options:
* `:follow-redirects` - `:never`, `:always` or `:normal`
* `:connect-timeout` - connection timeout in milliseconds.
* `:request` - default request options which will be used in requests made with this client.
* `:executor` - a `java.util.concurrent.Executor`
* `:ssl-context`: a `javax.net.ssl.SSLContext` or a map of options, see docstring of `->SSLContext`
* `:proxy`: a `java.net.ProxySelector` or a map of options, see docstring of `->ProxySelector`
* `:authenticator`: a `java.net.Authenticator` or a map of options, see docstring of `->Authenticator`.

Returns map with:

* `:client`, a `java.net.http.HttpClient`.

The map can be passed to `request` via the `:client` key.
raw docstring

default-client-optsclj

Options used to create the (implicit) default client.

Options used to create the (implicit) default client.
raw docstring

deleteclj

(delete uri)
(delete uri opts)

Convenience wrapper for request with method :delete

Convenience wrapper for `request` with method `:delete`
raw docstring

getclj

(get uri)
(get uri opts)

Convenience wrapper for request with method :get

Convenience wrapper for `request` with method `:get`
raw docstring

(head uri)
(head uri opts)

Convenience wrapper for request with method :head

Convenience wrapper for `request` with method `:head`
raw docstring

patchclj

(patch url)
(patch url opts)

Convenience wrapper for request with method :patch

Convenience wrapper for `request` with method `:patch`
raw docstring

postclj

(post uri)
(post uri opts)

Convenience wrapper for request with method :post

Convenience wrapper for `request` with method `:post`
raw docstring

putclj

(put url)
(put url opts)

Convenience wrapper for request with method :put

Convenience wrapper for `request` with method `:put`
raw docstring

requestclj

(request opts)

Perform request. Returns map with at least :body, :status

Options:

  • :uri - the uri to request (required). May be a string or map of :scheme (required), :host (required), :port, :path and :query
  • :headers - a map of headers
  • :method - the request method: :get, :post, :head, :delete, :patch or :put
  • :interceptors - custom interceptor chain
  • :client - a client as produced by client. If not provided a default client will be used.
  • :query-params - a map of query params. The values can be a list to send multiple params with the same key.
  • :form-params - a map of form params to send in the request body.
  • :body - a file, inputstream or string to send as the request body.
  • :basic-auth - a sequence of user password or map with :user :pass used for basic auth.
  • :async - perform request asynchronously. The response will be a CompletableFuture of the response map.
  • :async-then - a function that is called on the async result if successful
  • :async-catch - a function that is called on the async result if exceptional
  • :timeout - request timeout in milliseconds.
  • :version - the HTTP version: :http1.1 or :http2.
Perform request. Returns map with at least `:body`, `:status`

Options:

* `:uri` - the uri to request (required).
   May be a string or map of `:scheme` (required), `:host` (required), `:port`, `:path` and `:query`
* `:headers` - a map of headers
* `:method` - the request method: `:get`, `:post`, `:head`, `:delete`, `:patch` or `:put`
* `:interceptors` - custom interceptor chain
* `:client` - a client as produced by `client`. If not provided a default client will be used.
* `:query-params` - a map of query params. The values can be a list to send multiple params with the same key.
* `:form-params` - a map of form params to send in the request body.
* `:body` - a file, inputstream or string to send as the request body.
* `:basic-auth` - a sequence of `user` `password` or map with `:user` `:pass` used for basic auth.
* `:async` - perform request asynchronously. The response will be a `CompletableFuture` of the response map.
* `:async-then` - a function that is called on the async result if successful
* `:async-catch` - a function that is called on the async result if exceptional
* `:timeout` - request timeout in milliseconds.
* `:version` - the HTTP version: `:http1.1` or `:http2`.
raw docstring

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

× close