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
:accepts, 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
: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 ::accepts ::content-type ::headers ::socket ::binary-response ::insecure ])))
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
: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])))
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
: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])))
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 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 ::accepts ::content-type ::headers ::body ::form-params ::multipart-params ::socket])))
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 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 ::accepts ::content-type ::headers ::body ::form-params ::multipart-params ::socket])))
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 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 ::accepts ::content-type ::headers ::body ::form-params ::multipart-params ::socket ::insecure])))
ret: (keys :req-un [::body ::headers ::status])