planck.http

Planck HTTP functionality.

Vars

get
post

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
: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

Spec
args: (cat :url string? :opts (? (keys :opt-un [::timeout ::debug ::accepts ::content-type ::headers])))
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])))
ret: (keys :req-un [::body ::headers ::status])