Closed michaelwhitford closed 1 year ago
You are correct, this is default clj-http behaviour.
You can add an interceptor to this route, or all routes, to set the:throw-exceptions false
flag in the request, you you can set it in the :impl
key in martian options (see readme)
Hope this helps
Going to close this as the behaviour is explained, please feel free to reopen if you have other suggestions.
Thanks
I'm using clj-http with martian, and have an api that uses 404 with a json body to indicate a resource is not found.
I have a minimum repro for this in a git repo:
https://github.com/michaelwhitford/fulcro-swapi-client
The following line illustrates the problem:
https://github.com/michaelwhitford/fulcro-swapi-client/blob/ca5347644f9545e24ce1be1f00d00054897d0d7a/src/main/swapi/components/apis.clj#L26
When I try to execute a response for this api with a non-existant id, I get an exception from clj-http, rather than the json response object I have in the openapi spec file.
The spec file used for this is in the repository at
https://github.com/michaelwhitford/fulcro-swapi-client/blob/ca5347644f9545e24ce1be1f00d00054897d0d7a/openapi/swapi.yaml#L119
Can you give some pointers on how I would troubleshoot this? I do not see in the martian.clj-http code anywhere that it would override the 404, clj-http has an option to tell it which status codes are exceptions or not, but I it looks like martian is just using all the defaults afaict.