(->reader reader-or-kw)
Wrap a normal keyword on a reader map (see response->header
), and
set a default json body reader.
Wrap a normal keyword on a reader map (see `response->header`), and set a default json body reader.
(->seq x)
Returns x if x satisfies ISequential, otherwise vector of x.
Returns x if x satisfies ISequential, otherwise vector of x.
(->str x)
Returns the name String of x if x is a symbol or keyword, otherwise x.toString().
Returns the name String of x if x is a symbol or keyword, otherwise x.toString().
(body-problem-handler {:keys [request-id envelope? on-failure]
:or {on-failure [:fetch-no-on-failure]}}
response
{:keys [reader-kw] :as _reader}
js-error)
(body-success-handler {:keys [request-id envelope? on-success on-failure]
:or {on-success [:fetch-no-on-success]
on-failure [:fetch-no-on-failure]}}
response
{:keys [reader-kw reader-fn] :as _reader}
js-body)
(fetch {:keys [url timeout params request-id envelope? on-request-id
abort-signal]
:as request
:or {request-id (keyword (gensym "fetch-fx-"))}})
Initialise the request. Returns nil.
Initialise the request. Returns nil.
(headers->js headers)
Returns a new js/Headers JavaScript object of the ClojureScript map of headers.
Returns a new js/Headers JavaScript object of the ClojureScript map of headers.
(js-headers->clj js-headers)
Returns a new ClojureScript map of the js/Headers JavaScript object.
Returns a new ClojureScript map of the js/Headers JavaScript object.
(js-response->clj js-response)
Returns a new ClojureScript map of the js/Response JavaScript object.
Returns a new ClojureScript map of the js/Response JavaScript object.
(params->str params)
Returns a URI-encoded string of the params.
Returns a URI-encoded string of the params.
(request->js-init {:keys [method headers request-content-type body mode
credentials cache redirect referrer integrity]}
abort-signal)
Returns an init options js/Object to use as the second argument to js/fetch.
Returns an init options js/Object to use as the second argument to js/fetch.
(response->reader {:keys [response-content-types]} response)
Returns a reader map or the default-text-reader
to use for the body of the
response according to the Content-Type header.
A reader map is one with 2 keys:
reader-kw
: a keyword to indicate what js/Body method should be used.reader-fn
: a function that processes the js-body
as required.Returns a reader map or the `default-text-reader` to use for the body of the response according to the Content-Type header. A reader map is one with 2 keys: - `reader-kw`: a keyword to indicate what js/Body method should be used. - `reader-fn`: a function that processes the `js-body` as required.
(response-problem-handler {:keys [request-id envelope? on-failure]
:or {on-failure [:fetch-no-on-failure]}}
js-error)
(response-success-handler request js-response)
Reads the js/Response JavaScript Object stream to completion. Returns nil.
Reads the js/Response JavaScript Object stream to completion. Returns nil.
(timeout-race js-promise timeout)
Returns a js/Promise JavaScript object that is a race between another js/Promise JavaScript object and timeout in ms if timeout is not nil, otherwise js-promise.
Returns a js/Promise JavaScript object that is a race between another js/Promise JavaScript object and timeout in ms if timeout is not nil, otherwise js-promise.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close