Convenience functions for HTTP requests.
Provides HTTP convenience functions (get, post, put, delete, etc.) as a higher-level API on top of the lower-level client/send function.
All functions accept a URI and optional request map, and return the response as a Clojure map.
Convenience functions for HTTP requests. Provides HTTP convenience functions (get, post, put, delete, etc.) as a higher-level API on top of the lower-level client/send function. All functions accept a URI and optional request map, and return the response as a Clojure map.
(connect uri)(connect uri request-map)Sends a CONNECT request to the specified URI.
Arity 1: (connect uri) Arity 2: (connect uri request-map)
The request-map is merged with method :connect and the given uri. Use the second arity to add headers, timeout, etc.
Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
Sends a CONNECT request to the specified URI. Arity 1: (connect uri) Arity 2: (connect uri request-map) The request-map is merged with method :connect and the given uri. Use the second arity to add headers, timeout, etc. Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
(connect-async uri)(connect-async uri request-map)Sends a CONNECT request asynchronously to the specified URI.
Arity 1: (connect-async uri) Arity 2: (connect-async uri request-map)
The request-map is merged with method :connect and the given uri. Use the second arity to add headers, timeout, etc.
Returns a CompletableFuture that will complete with the response map.
Sends a CONNECT request asynchronously to the specified URI. Arity 1: (connect-async uri) Arity 2: (connect-async uri request-map) The request-map is merged with method :connect and the given uri. Use the second arity to add headers, timeout, etc. Returns a CompletableFuture that will complete with the response map.
(delete uri)(delete uri request-map)Sends a DELETE request to the specified URI.
Arity 1: (delete uri) Arity 2: (delete uri request-map)
The request-map is merged with method :delete and the given uri. Use the second arity to add headers, timeout, body, etc.
Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
Sends a DELETE request to the specified URI. Arity 1: (delete uri) Arity 2: (delete uri request-map) The request-map is merged with method :delete and the given uri. Use the second arity to add headers, timeout, body, etc. Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
(delete-async uri)(delete-async uri request-map)Sends a DELETE request asynchronously to the specified URI.
Arity 1: (delete-async uri) Arity 2: (delete-async uri request-map)
The request-map is merged with method :delete and the given uri. Use the second arity to add headers, timeout, body, etc.
Returns a CompletableFuture that will complete with the response map.
Sends a DELETE request asynchronously to the specified URI. Arity 1: (delete-async uri) Arity 2: (delete-async uri request-map) The request-map is merged with method :delete and the given uri. Use the second arity to add headers, timeout, body, etc. Returns a CompletableFuture that will complete with the response map.
(get uri)(get uri request-map)Sends a GET request to the specified URI.
Arity 1: (get uri) Arity 2: (get uri request-map)
The request-map is merged with method :get and the given uri. Use the second arity to add headers, timeout, body, etc.
Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
Sends a GET request to the specified URI. Arity 1: (get uri) Arity 2: (get uri request-map) The request-map is merged with method :get and the given uri. Use the second arity to add headers, timeout, body, etc. Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
(get-async uri)(get-async uri request-map)Sends a GET request asynchronously to the specified URI.
Arity 1: (get-async uri) Arity 2: (get-async uri request-map)
The request-map is merged with method :get and the given uri. Use the second arity to add headers, timeout, body, etc.
Returns a CompletableFuture that will complete with the response map.
Sends a GET request asynchronously to the specified URI. Arity 1: (get-async uri) Arity 2: (get-async uri request-map) The request-map is merged with method :get and the given uri. Use the second arity to add headers, timeout, body, etc. Returns a CompletableFuture that will complete with the response map.
(head uri)(head uri request-map)Sends a HEAD request to the specified URI.
Arity 1: (head uri) Arity 2: (head uri request-map)
The request-map is merged with method :head and the given uri. Use the second arity to add headers, timeout, etc.
Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
Sends a HEAD request to the specified URI. Arity 1: (head uri) Arity 2: (head uri request-map) The request-map is merged with method :head and the given uri. Use the second arity to add headers, timeout, etc. Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
(head-async uri)(head-async uri request-map)Sends a HEAD request asynchronously to the specified URI.
Arity 1: (head-async uri) Arity 2: (head-async uri request-map)
The request-map is merged with method :head and the given uri. Use the second arity to add headers, timeout, etc.
Returns a CompletableFuture that will complete with the response map.
Sends a HEAD request asynchronously to the specified URI. Arity 1: (head-async uri) Arity 2: (head-async uri request-map) The request-map is merged with method :head and the given uri. Use the second arity to add headers, timeout, etc. Returns a CompletableFuture that will complete with the response map.
(options uri)(options uri request-map)Sends an OPTIONS request to the specified URI.
Arity 1: (options uri) Arity 2: (options uri request-map)
The request-map is merged with method :options and the given uri. Use the second arity to add headers, timeout, etc.
Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
Sends an OPTIONS request to the specified URI. Arity 1: (options uri) Arity 2: (options uri request-map) The request-map is merged with method :options and the given uri. Use the second arity to add headers, timeout, etc. Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
(options-async uri)(options-async uri request-map)Sends an OPTIONS request asynchronously to the specified URI.
Arity 1: (options-async uri) Arity 2: (options-async uri request-map)
The request-map is merged with method :options and the given uri. Use the second arity to add headers, timeout, etc.
Returns a CompletableFuture that will complete with the response map.
Sends an OPTIONS request asynchronously to the specified URI. Arity 1: (options-async uri) Arity 2: (options-async uri request-map) The request-map is merged with method :options and the given uri. Use the second arity to add headers, timeout, etc. Returns a CompletableFuture that will complete with the response map.
(patch uri)(patch uri request-map)Sends a PATCH request to the specified URI.
Arity 1: (patch uri) Arity 2: (patch uri request-map)
The request-map is merged with method :patch and the given uri. Use the second arity to add body, headers, timeout, etc.
Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
Sends a PATCH request to the specified URI. Arity 1: (patch uri) Arity 2: (patch uri request-map) The request-map is merged with method :patch and the given uri. Use the second arity to add body, headers, timeout, etc. Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
(patch-async uri)(patch-async uri request-map)Sends a PATCH request asynchronously to the specified URI.
Arity 1: (patch-async uri) Arity 2: (patch-async uri request-map)
The request-map is merged with method :patch and the given uri. Use the second arity to add body, headers, timeout, etc.
Returns a CompletableFuture that will complete with the response map.
Sends a PATCH request asynchronously to the specified URI. Arity 1: (patch-async uri) Arity 2: (patch-async uri request-map) The request-map is merged with method :patch and the given uri. Use the second arity to add body, headers, timeout, etc. Returns a CompletableFuture that will complete with the response map.
(post uri)(post uri request-map)Sends a POST request to the specified URI.
Arity 1: (post uri) Arity 2: (post uri request-map)
The request-map is merged with method :post and the given uri. Use the second arity to add body, headers, timeout, etc.
Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
Sends a POST request to the specified URI. Arity 1: (post uri) Arity 2: (post uri request-map) The request-map is merged with method :post and the given uri. Use the second arity to add body, headers, timeout, etc. Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
(post-async uri)(post-async uri request-map)Sends a POST request asynchronously to the specified URI.
Arity 1: (post-async uri) Arity 2: (post-async uri request-map)
The request-map is merged with method :post and the given uri. Use the second arity to add body, headers, timeout, etc.
Returns a CompletableFuture that will complete with the response map.
Sends a POST request asynchronously to the specified URI. Arity 1: (post-async uri) Arity 2: (post-async uri request-map) The request-map is merged with method :post and the given uri. Use the second arity to add body, headers, timeout, etc. Returns a CompletableFuture that will complete with the response map.
(put uri)(put uri request-map)Sends a PUT request to the specified URI.
Arity 1: (put uri) Arity 2: (put uri request-map)
The request-map is merged with method :put and the given uri. Use the second arity to add body, headers, timeout, etc.
Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
Sends a PUT request to the specified URI. Arity 1: (put uri) Arity 2: (put uri request-map) The request-map is merged with method :put and the given uri. Use the second arity to add body, headers, timeout, etc. Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
(put-async uri)(put-async uri request-map)Sends a PUT request asynchronously to the specified URI.
Arity 1: (put-async uri) Arity 2: (put-async uri request-map)
The request-map is merged with method :put and the given uri. Use the second arity to add body, headers, timeout, etc.
Returns a CompletableFuture that will complete with the response map.
Sends a PUT request asynchronously to the specified URI. Arity 1: (put-async uri) Arity 2: (put-async uri request-map) The request-map is merged with method :put and the given uri. Use the second arity to add body, headers, timeout, etc. Returns a CompletableFuture that will complete with the response map.
(query uri)(query uri request-map)Sends a QUERY request to the specified URI.
Arity 1: (query uri) Arity 2: (query uri request-map)
The request-map is merged with method :query and the given uri. Use the second arity to add headers, timeout, etc.
Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
Sends a QUERY request to the specified URI. Arity 1: (query uri) Arity 2: (query uri request-map) The request-map is merged with method :query and the given uri. Use the second arity to add headers, timeout, etc. Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
(query-async uri)(query-async uri request-map)Sends a QUERY request asynchronously to the specified URI.
Arity 1: (query-async uri) Arity 2: (query-async uri request-map)
The request-map is merged with method :query and the given uri. Use the second arity to add headers, timeout, etc.
Returns a CompletableFuture that will complete with the response map.
Sends a QUERY request asynchronously to the specified URI. Arity 1: (query-async uri) Arity 2: (query-async uri request-map) The request-map is merged with method :query and the given uri. Use the second arity to add headers, timeout, etc. Returns a CompletableFuture that will complete with the response map.
(request request)Sends an HTTP request using the default client.
Takes a request map with the same keys as java-http.request/build. The request map can also include: :body-handler - Keyword: :string (default), :bytes, :input-stream, :discarding, :file Or an HttpResponse$BodyHandler instance, or a function. :body-handler-file - Path, File, or String (required when :body-handler is :file)
This is the underlying function used by all the HTTP convenience functions.
See java-http.request/build for request map format. See java-http.client/send for return value format.
Sends an HTTP request using the default client.
Takes a request map with the same keys as java-http.request/build.
The request map can also include:
:body-handler - Keyword: :string (default), :bytes, :input-stream, :discarding, :file
Or an HttpResponse$BodyHandler instance, or a function.
:body-handler-file - Path, File, or String (required when :body-handler is :file)
This is the underlying function used by all the HTTP convenience functions.
See java-http.request/build for request map format.
See java-http.client/send for return value format.(request-async request)Sends an HTTP request asynchronously using the default client.
Takes a request map with the same keys as request. The request map can also include: :body-handler - Keyword: :string (default), :bytes, :input-stream, :discarding, :file Or an HttpResponse$BodyHandler instance, or a function. :body-handler-file - Path, File, or String (required when :body-handler is :file)
Returns a CompletableFuture that will complete with the response map.
See java-http.request/build for request map format. See java-http.client/send-async for return value.
Sends an HTTP request asynchronously using the default client.
Takes a request map with the same keys as request.
The request map can also include:
:body-handler - Keyword: :string (default), :bytes, :input-stream, :discarding, :file
Or an HttpResponse$BodyHandler instance, or a function.
:body-handler-file - Path, File, or String (required when :body-handler is :file)
Returns a CompletableFuture that will complete with the response map.
See java-http.request/build for request map format.
See java-http.client/send-async for return value.(trace uri)(trace uri request-map)Sends a TRACE request to the specified URI.
Arity 1: (trace uri) Arity 2: (trace uri request-map)
The request-map is merged with method :trace and the given uri. Use the second arity to add headers, timeout, etc.
Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
Sends a TRACE request to the specified URI. Arity 1: (trace uri) Arity 2: (trace uri request-map) The request-map is merged with method :trace and the given uri. Use the second arity to add headers, timeout, etc. Returns a response map with keys: :body, :headers, :status, :uri, :version, :previous-response, :ssl-session.
(trace-async uri)(trace-async uri request-map)Sends a TRACE request asynchronously to the specified URI.
Arity 1: (trace-async uri) Arity 2: (trace-async uri request-map)
The request-map is merged with method :trace and the given uri. Use the second arity to add headers, timeout, etc.
Returns a CompletableFuture that will complete with the response map.
Sends a TRACE request asynchronously to the specified URI. Arity 1: (trace-async uri) Arity 2: (trace-async uri request-map) The request-map is merged with method :trace and the given uri. Use the second arity to add headers, timeout, etc. Returns a CompletableFuture that will complete with the response map.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |