(bearer-auth req token)
Add a bearer authorization in to the request headers
Add a bearer authorization in to the request headers
(call! req)
(call! req cb)
(call! method url http-opts)
(call! method url http-opts cb)
Returns a promise if no callback is passed in. Derefing the promise will yield the http response. http-opts is a map of options used by http-kit. method is a keyword
Returns a promise if no callback is passed in. Derefing the promise will yield the http response. http-opts is a map of options used by http-kit. method is a keyword
(check-successful-response resp)
(check-successful-response {:keys [status body] :as resp} non-success-fn)
Checks that the input response map has a successful status code (200 series) and returns the input response. If unsuccessful (non 200 series response code), invokes non-success-fn with the response map. The 1 arity function throws an exception.
Checks that the input response map has a successful status code (200 series) and returns the input response. If unsuccessful (non 200 series response code), invokes non-success-fn with the response map. The 1 arity function throws an exception.
(content-type->name s)
Returns a keyword ie :json, :edn or :other. NB input ``s can be nil
.
Returns a keyword ie :json, :edn or :other. NB input ``s can be `nil`.
(edn? content-type)
Answers true if the content-type is application/json. Ignores case, handles nil.
Answers true if the content-type is application/json. Ignores case, handles nil.
(json-content req)
(json-content req body)
Adds in content-type and json encodes the body.
Adds in content-type and json encodes the body.
(json? content-type)
Answers true if the content-type is application/json. Ignores case, handles nil.
Answers true if the content-type is application/json. Ignores case, handles nil.
(parse-response-body resp)
(parse-response-body edn-read-opts {:keys [body headers] :as resp})
Checks for a successful response and parses the response body to a clojure data structure
Checks for a successful response and parses the response body to a clojure data structure
(success? status-code)
Answers if the input status-code is a http success code.
Answers if the input status-code is a http success code.
(sync-call! req)
(sync-call! method url http-opts)
Makes a blocking http call. Returns the parsed response body as a clojure data structure. http-opts is a map of options used by http-kit.
Makes a blocking http call. Returns the parsed response body as a clojure data structure. http-opts is a map of options used by http-kit.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close