Liking cljdoc? Tell your friends :D

martian.encoding


auto-coercion-by-client?clj/s

(auto-coercion-by-client? {:keys [type value] :as _coerce-as}
                          {:keys [auto-coercion-pred] :as _coerce-opts})

Checks if a response should have already gone through the client's auto-coercion (to avoid double coercion of the same sort).

A workaround needed specifically for clj-http and hato clients with response auto-coercion being turned on e.g. due to a presence of the '/' response content in the OpenAPI/Swagger definition.

Checks if a response should have already gone through the client's
auto-coercion (to avoid double coercion of the same sort).

A workaround needed specifically for `clj-http` and `hato` clients
with response auto-coercion being turned on e.g. due to a presence
of the '*/*' response content in the OpenAPI/Swagger definition.
sourceraw docstring

auto-encoderclj/s

source

choose-media-typeclj/s

(choose-media-type encoders options)
source

find-encoderclj/s

(find-encoder encoders media-type)
source

get-coerce-asclj/s

(get-coerce-as encoders
               media-type
               {:keys [type-aliases missing-encoder-as default-encoder-as]})
source

get-type-subtypeclj/s

(get-type-subtype media-type)
source

set-default-coerce-optsclj/s

(set-default-coerce-opts
  {:keys [skip-decoding-for auto-coercion-pred type-aliases request-key
          missing-encoder-as default-encoder-as]
   :or {missing-encoder-as :auto default-encoder-as :string}})

Returns an HTTP client-specific response coercion options, applying default values, if necessary:

  • :skip-decoding-for — a set of media types for which the decoding can be skipped in favor of the client built-in one
  • :auto-coercion-pred — a pred of coerce-as-value that checks whether client response auto-coercion has been applied
  • :request-key — usually :as, though some clients expect other keys, e.g. :response-type for the cljs-http
  • :type-aliases — a mapping of client-specific (raw) type aliases
  • :missing-encoder-as — for the case where the media type is missing or when there is no encoder for the specified type
  • :default-encoder-as — for in case the found encoder for the specified media type omits its own :as value
Returns an HTTP client-specific response coercion options, applying default
values, if necessary:
- `:skip-decoding-for`    — a set of media types for which the decoding can
                            be skipped in favor of the client built-in one
- `:auto-coercion-pred`   — a pred of `coerce-as-value` that checks whether
                            client response auto-coercion has been applied
- `:request-key`          — usually `:as`, though some clients expect other
                            keys, e.g. `:response-type` for the `cljs-http`
- `:type-aliases`         — a mapping of client-specific (raw) type aliases
- `:missing-encoder-as`   — for the case where the media type is missing or
                            when there is no encoder for the specified type
- `:default-encoder-as`   — for in case the found encoder for the specified
                            media type omits its own `:as` value
sourceraw docstring

skip-decoding?clj/s

(skip-decoding? {:keys [type] :as _coerce-as}
                content-type
                {:keys [skip-decoding-for] :as _coerce-opts})

Checks whether a response decoding (by Martian) should be skipped.

Skip only when the client did coerce a response to the final type, which may not be the case if the 'Accept' encoder had some custom (non-default) :as value, meaning it still expects to decode the response from this (intermediary) type to the final one.

Checks whether a response decoding (by Martian) should be skipped.

Skip only when the client did coerce a response to the final type,
which may not be the case if the 'Accept' encoder had some custom
(non-default) `:as` value, meaning it still expects to decode the
response from this (intermediary) type to the final one.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close