An obvious use case that was poorly handled in older versions is to set-and-forget configuration. As such, configuration is now stored as an atom
rather than a dynamic var
.
0.1.5 | 1.0.0 |
---|---|
(binding [rest/*opts* ...] ...) | N/A [Dynamic binding] |
(set! rest/*opts* ...) | (swap! rest/config assoc :request-defaults ...) [Request options] |
:response-format ... | (rest/configure-format! ...) (:json , :edn and :transit are supported) |
It turns out binding
does not behave as expected with asynchronous ClojureScript. The best approximate replacement is to include :opts
keyword argument when constructing a resource type.
Because the underlying request library was changed to cljs-http from cljs-ajax, request options were changed accordingly.
Methods were renamed to match their respective HTTP verbs.
0.1.5 | 1.0.0 |
---|---|
rest/read | rest/get |
rest/create! | rest/post! |
rest/update! | rest/put! |
0.1.5 | 1.0.0 |
---|---|
(rest/patch! listing (FormData. ...)) | (rest/patch! listing (rest/multipart-params {:field val})) |
0.1.5 | 1.0.0 |
---|---|
:ok? | :success |
(get-in resource [:data :status]) etc | (:status resource) |
:error-handler (fn [err] ...) | :error-chan (chan) |
0.1.5 | 1.0.0 |
---|---|
(:data listing) | (:resources listing) |
(first-item listing) | (first-resource listing) |
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close