planck.http

Planck HTTP functionality.

Vars

get
head
delete
post
put
patch

Vars

get

([url] [url opts]) Performs a GET request. It takes an URL and an optional map of options. These include:
:timeout, number, default 5 seconds
:debug, boolean, assoc the request on to the response
:insecure, proceed even if the connection is considered insecure
:accept, keyword or string. Valid keywords are :json or :xml
:content-type, keyword or string Valid keywords are :json or :xml
:headers, map, a map containing headers
:user-agent, string, the user agent header to send
:follow-redirects, boolean, follow HTTP location redirects :max-redirects, number, maximum number of redirects to follow :socket, string, specifying a system path to a socket to use
:binary-response, boolean, encode response body as vector of unsigned bytes

Spec
args: (cat :url string? :opts (? (keys :opt-un [::timeout ::debug ::accept ::content-type ::headers ::socket ::binary-response ::insecure ::user-agent ::follow-redirects ::max-redirects])))
ret: (keys :req-un [::body ::headers ::status])

head

([url] [url opts]) Performs a HEAD request. It takes an URL and an optional map of options. These include:
:timeout, number, default 5 seconds
:debug, boolean, assoc the request on to the response
:insecure, proceed even if the connection is considered insecure
:headers, map, a map containing headers
:user-agent, string, the user agent header to send
:socket, string, specifying a system path to a socket to use

Spec
args: (cat :url string? :opts (? (keys :opt-un [::timeout ::debug ::headers ::socket ::insecure ::user-agent])))
ret: (keys :req-un [::body ::headers ::status])

delete

([url] [url opts]) Performs a DELETE request. It takes an URL and an optional map of options. These include:
:timeout, number, default 5 seconds
:debug, boolean, assoc the request on to the response
:headers, map, a map containing headers
:user-agent, string, the user agent header to send
:socket, string, specifying a system path to a socket to use

Spec
args: (cat :url string? :opts (? (keys :opt-un [::timeout ::debug ::headers ::socket ::insecure ::user-agent])))
ret: (keys :req-un [::body ::headers ::status])

post

([url] [url opts])
Performs a POST request. It takes an URL and an optional map of options These options include the relevant options for get in addition to:
:form-params, a map, will become the body of the request, urlencoded
:multipart-params, a list of tuples, used for file-upload
{:multipart-params [["name" "value"]
["name" ["content" "filename"]]

Spec
args: (cat :url string? :opts (? (keys :opt-un [::timeout ::debug ::accept ::content-type ::headers ::body ::form-params ::multipart-params ::socket ::user-agent])))
ret: (keys :req-un [::body ::headers ::status ::insecure])

put

([url] [url opts])
Performs a PUT request. It takes an URL and an optional map of options These options include the relevant options for get in addition to:
:form-params, a map, will become the body of the request, urlencoded
:multipart-params, a list of tuples, used for file-upload
{:multipart-params [["name" "value"]
["name" ["content" "filename"]]

Spec
args: (cat :url string? :opts (? (keys :opt-un [::timeout ::debug ::accept ::content-type ::headers ::body ::form-params ::multipart-params ::socket ::user-agent])))
ret: (keys :req-un [::body ::headers ::status ::insecure])

patch

([url] [url opts])
Performs a PATCH request. It takes an URL and an optional map of options These options include the relevant options for get in addition to:
:form-params, a map, will become the body of the request, urlencoded
:multipart-params, a list of tuples, used for file-upload
{:multipart-params [["name" "value"]
["name" ["content" "filename"]]

Spec
args: (cat :url string? :opts (? (keys :opt-un [::timeout ::debug ::accept ::content-type ::headers ::body ::form-params ::multipart-params ::socket ::insecure ::user-agent])))
ret: (keys :req-un [::body ::headers ::status])