Closed LucianoLaratelli closed 10 months ago
Hello,
There are a couple of things to be aware of here:
martian.core/default-interceptors
does not contain the content encoding/decoding interceptors, or the perform-request
interceptor you need for a functioning martian. You need to use martian.clj-http/default-interceptors
in this instance.perform-request
interceptor (which is at the end of the default interceptors).Hopefully then, this code will work:
(ns user
(:require [martian.clj-http :as martian-http]
[martian.core :as martian]))
(def add-authentication-header
{:name ::add-authentication-header
:enter (fn [ctx]
(assoc-in ctx [:request :headers "Authorization"] "Authorization: Bearer my-cool-bearer-token"))})
(def m (martian-http/bootstrap-openapi
"https://api.ynab.com/papi/open_api_spec.yaml"
{:interceptors (concat [add-authentication-header]
martian-http/default-interceptors)}))
I am also seeing the
No matching content-type available {:supported-content-types #{}, :available-content-types (application/json), :header Content-Type}
with the following call:
(def m (martian-http/bootstrap-openapi "resources/descriptors.yaml"
{:interceptors
(concat [add-authentication-header
allow-insecure]
martian/default-interceptors)}))
Is there some extra encoding that I need to add? If I do two calls to the explore function the first gives me the errors, the second does not.
Hi @mmeroberts ,
As above, you need to change martian/default-interceptors
to martian-http/default-interceptors
as only the latter contains the encoding/decoding and perform-request
interceptors that you need.
Cheers
Hi @mmeroberts ,
As above, you need to change
martian/default-interceptors
tomartian-http/default-interceptors
as only the latter contains the encoding/decoding andperform-request
interceptors that you need.Cheers
My issue was fixed when I added a specific encoder for application/yaml
Thanks
Hi @mmeroberts thanks for the update. Interesting idea about another function on the API to identify potential issues. Martian already has spec instrumentation to help when specifying your own API without swagger, perhaps that could also be leveraged to discover where there are no acceptable content types?
@LucianoLaratelli is your issue also resolved now (thanks for the update to the readme, I think it is clearer now)?
Yes, all good on my end. Thank you for the help!
Hello,
I'm trying out Martian for the YNAB API:
But I'm getting this message:
What am I doing wrong here? I tried setting content-type manually with an interceptor:
But got the same result.