bump dependencies
kill deprecated request decompression param
:output-ch
, same as bulk-chan
.Add chan->seq utility function
bump ES dep to 5.5.0
:url
key in request-maps is not protocolized, as a result all
request functions now accept the request :url
key as String or
Keyword or Sequential (potentially 2d), the same way
qbits.spandex.utils/url
used to work in that case.
you can now write:
(request client {:url "/foo" ...})
(request client {:url :foo ...})
(request client {:url [:foo :bar "baz"] ...})
(request client {:url [:foo [:bar :baz "prout"]] ...})
depreciated qbits.spandex.utils/url
. It now lives under
qbits.spandex.url/encode
, there's an alias so it should be
backward compatible.
bump cheshire and elasticsearch client dependency
proper content-type defaults to prevent warnings with ES 5.3+
request-chan now accepts a :ch
option which defaults to the
original promise-chan
returned by the function.
Bump dependencies (cheshire, codox)
make scroll-chan
2.x- compatible
ResponseExceptions are now returned as ex-info instances wrapping the real response decoded as clojure map.
That means you can just call ex-data on it and get to it that way
(try (s/request client {:url "/a/a/a/a/a"})
(catch clojure.lang.ExceptionInfo ex
(prn (ex-data ex))))
=> #qbits.spandex.Response{
:type :qbits.spandex/response-exception
:body "No handler found for uri [/a/a/a/a/a] and method [GET]"
:status 400
:headers {"Content-Type" "text/plain; charset=UTF-8", "Content-Length" "54"}
:hosts #object[org.apache.http.HttpHost 0x968acb8 "http://localhost:9200"]}
You can overwrite this behavior in a few ways:
the default :exception-handler
(aka default-exception-handler
)
calls ExceptionDecoder/decode-exception
which is a protocol based
function, when the result is a throwable it will rethrow otherwise
it returns the value. That means you can just extend it if you
prefer to have qbits.spandex.Response
as a value. Doing so will
also be valid for async request triggering functions (minus the
throwing).
something like the following
(extend-protocol ExceptionDecoder
ResponseException
(decode-exception [x] (response-ex->response x)))
Or you can pass your own :exception-handler
to all request triggering
functions to do whatever you'd like and bypass the protocol altogether.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close