(client url)
(client url opts)
Create a new HTTP client that utilises the given TCP or UNIX domain socket to perform HTTP communication. Options are:
:base-url
: A string containing the base URL to use for HTTP calls; by
default this will be the URL given to create the client.:timeout-ms
: A timeout that will be used for connect/call/read/write
timeout settings, unless they are explicitly specified using the
following options:
:connect-timeout-ms
:call-timeout-ms
:read-timeout-ms
:write-timeout-ms
:mode
: A keyword describing the connection behaviour:
:default
: A reusable client will be created, except for raw socket
access where a new connection will be established.:reuse
: A reusable client will be created, and raw socket access will
not be possible.:recreate
: For every request a new client will be created; this might
be useful if you encounter problems with sharing the client across
threads.:builder-fn
: A function that will be called on the underlying
OkHttpClient$Builder
and can be used to perform arbitrary adjustments
to the HTTP client (with exception of the socket factory).Examples:
(client "unix:///var/run/docker.sock")
(client "tcp://127.0.0.1:6537")
Create a new HTTP client that utilises the given TCP or UNIX domain socket to perform HTTP communication. Options are: - `:base-url`: A string containing the base URL to use for HTTP calls; by default this will be the URL given to create the client. - `:timeout-ms`: A timeout that will be used for connect/call/read/write timeout settings, unless they are explicitly specified using the following options: - `:connect-timeout-ms` - `:call-timeout-ms` - `:read-timeout-ms` - `:write-timeout-ms` - `:mode`: A keyword describing the connection behaviour: - `:default`: A reusable client will be created, except for raw socket access where a new connection will be established. - `:reuse`: A reusable client will be created, and raw socket access will not be possible. - `:recreate`: For every request a new client will be created; this might be useful if you encounter problems with sharing the client across threads. - `:builder-fn`: A function that will be called on the underlying `OkHttpClient$Builder` and can be used to perform arbitrary adjustments to the HTTP client (with exception of the socket factory). Examples: ``` (client "unix:///var/run/docker.sock") (client "tcp://127.0.0.1:6537") ```
(delete client url)
(delete client url opts)
Perform a DELETE request against the given client. Options are:
:headers
: a map of string/string pairs that will be sent as headers.:query-params
: a map of string/string pairs that will be sent as the query string.:as
: if set to :stream
the response's body will be an InputStream
value (that needs to be closed after consuming).:throw-exceptions?
: if set to false
all responses will be returned and no exception is thrown on HTTP error codes.:throw-entire-message?
: if set to true
HTTP exceptions will contain the full response as ex-data
; streams and sockets will not be closed automatically!Perform a DELETE request against the given client. Options are: - `:headers`: a map of string/string pairs that will be sent as headers. - `:query-params`: a map of string/string pairs that will be sent as the query string. - `:as`: if set to `:stream` the response's body will be an `InputStream` value (that needs to be closed after consuming). - `:throw-exceptions?`: if set to `false` all responses will be returned and no exception is thrown on HTTP error codes. - `:throw-entire-message?`: if set to `true` HTTP exceptions will contain the full response as `ex-data`; streams and sockets will not be closed automatically!
(get client url)
(get client url opts)
Perform a GET request against the given client. Options are:
:headers
: a map of string/string pairs that will be sent as headers.:query-params
: a map of string/string pairs that will be sent as the query string.:as
: if set to :stream
the response's body will be an InputStream
value (that needs to be closed after consuming).:throw-exceptions?
: if set to false
all responses will be returned and no exception is thrown on HTTP error codes.:throw-entire-message?
: if set to true
HTTP exceptions will contain the full response as ex-data
; streams and sockets will not be closed automatically!Perform a GET request against the given client. Options are: - `:headers`: a map of string/string pairs that will be sent as headers. - `:query-params`: a map of string/string pairs that will be sent as the query string. - `:as`: if set to `:stream` the response's body will be an `InputStream` value (that needs to be closed after consuming). - `:throw-exceptions?`: if set to `false` all responses will be returned and no exception is thrown on HTTP error codes. - `:throw-entire-message?`: if set to `true` HTTP exceptions will contain the full response as `ex-data`; streams and sockets will not be closed automatically!
(head client url)
(head client url opts)
Perform a HEAD request against the given client. Options are:
:headers
: a map of string/string pairs that will be sent as headers.:query-params
: a map of string/string pairs that will be sent as the query string.:as
: if set to :stream
the response's body will be an InputStream
value (that needs to be closed after consuming).:throw-exceptions?
: if set to false
all responses will be returned and no exception is thrown on HTTP error codes.:throw-entire-message?
: if set to true
HTTP exceptions will contain the full response as ex-data
; streams and sockets will not be closed automatically!Perform a HEAD request against the given client. Options are: - `:headers`: a map of string/string pairs that will be sent as headers. - `:query-params`: a map of string/string pairs that will be sent as the query string. - `:as`: if set to `:stream` the response's body will be an `InputStream` value (that needs to be closed after consuming). - `:throw-exceptions?`: if set to `false` all responses will be returned and no exception is thrown on HTTP error codes. - `:throw-entire-message?`: if set to `true` HTTP exceptions will contain the full response as `ex-data`; streams and sockets will not be closed automatically!
(patch client url)
(patch client url opts)
Perform a PATCH request against the given client. Options are:
:headers
: a map of string/string pairs that will be sent as headers.:query-params
: a map of string/string pairs that will be sent as the query string.:as
: if set to :stream
the response's body will be an InputStream
value (that needs to be closed after consuming).:throw-exceptions?
: if set to false
all responses will be returned and no exception is thrown on HTTP error codes.:throw-entire-message?
: if set to true
HTTP exceptions will contain the full response as ex-data
; streams and sockets will not be closed automatically!Perform a PATCH request against the given client. Options are: - `:headers`: a map of string/string pairs that will be sent as headers. - `:query-params`: a map of string/string pairs that will be sent as the query string. - `:as`: if set to `:stream` the response's body will be an `InputStream` value (that needs to be closed after consuming). - `:throw-exceptions?`: if set to `false` all responses will be returned and no exception is thrown on HTTP error codes. - `:throw-entire-message?`: if set to `true` HTTP exceptions will contain the full response as `ex-data`; streams and sockets will not be closed automatically!
(post client url)
(post client url opts)
Perform a POST request against the given client. Options are:
:headers
: a map of string/string pairs that will be sent as headers.:query-params
: a map of string/string pairs that will be sent as the query string.:as
: if set to :stream
the response's body will be an InputStream
value (that needs to be closed after consuming).:throw-exceptions?
: if set to false
all responses will be returned and no exception is thrown on HTTP error codes.:throw-entire-message?
: if set to true
HTTP exceptions will contain the full response as ex-data
; streams and sockets will not be closed automatically!Perform a POST request against the given client. Options are: - `:headers`: a map of string/string pairs that will be sent as headers. - `:query-params`: a map of string/string pairs that will be sent as the query string. - `:as`: if set to `:stream` the response's body will be an `InputStream` value (that needs to be closed after consuming). - `:throw-exceptions?`: if set to `false` all responses will be returned and no exception is thrown on HTTP error codes. - `:throw-entire-message?`: if set to `true` HTTP exceptions will contain the full response as `ex-data`; streams and sockets will not be closed automatically!
(put client url)
(put client url opts)
Perform a PUT request against the given client. Options are:
:headers
: a map of string/string pairs that will be sent as headers.:query-params
: a map of string/string pairs that will be sent as the query string.:as
: if set to :stream
the response's body will be an InputStream
value (that needs to be closed after consuming).:throw-exceptions?
: if set to false
all responses will be returned and no exception is thrown on HTTP error codes.:throw-entire-message?
: if set to true
HTTP exceptions will contain the full response as ex-data
; streams and sockets will not be closed automatically!Perform a PUT request against the given client. Options are: - `:headers`: a map of string/string pairs that will be sent as headers. - `:query-params`: a map of string/string pairs that will be sent as the query string. - `:as`: if set to `:stream` the response's body will be an `InputStream` value (that needs to be closed after consuming). - `:throw-exceptions?`: if set to `false` all responses will be returned and no exception is thrown on HTTP error codes. - `:throw-entire-message?`: if set to `true` HTTP exceptions will contain the full response as `ex-data`; streams and sockets will not be closed automatically!
(request request)
Perform an HTTP request. Options are:
:client
(required): the client
to use for the request.:method
(required): a keyword indicating the HTTP method to use.:url
(required): the URL/path to send the request to.:body
: request body, if supported by the HTTP method.:headers
: a map of string/string pairs that will be sent as headers.:query-params
: a map of string/string pairs that will be sent as the query string.:as
: if set to :stream
the response's body will be an InputStream
value (that needs to be closed after consuming).:throw-exceptions?
: if set to false
all responses will be returned and no exception is thrown on HTTP error codes.:throw-entire-message?
: if set to true
HTTP exceptions will contain the full response as ex-data
; streams and sockets will not be closed automatically!Perform an HTTP request. Options are: - `:client` (required): the `client` to use for the request. - `:method` (required): a keyword indicating the HTTP method to use. - `:url` (required): the URL/path to send the request to. - `:body`: request body, if supported by the HTTP method. - `:headers`: a map of string/string pairs that will be sent as headers. - `:query-params`: a map of string/string pairs that will be sent as the query string. - `:as`: if set to `:stream` the response's body will be an `InputStream` value (that needs to be closed after consuming). - `:throw-exceptions?`: if set to `false` all responses will be returned and no exception is thrown on HTTP error codes. - `:throw-entire-message?`: if set to `true` HTTP exceptions will contain the full response as `ex-data`; streams and sockets will not be closed automatically!
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close