Comments (5)
Hi,
Which http library are you using? You will need to either write an interceptor to add the appropriate parameters to the request map or to provide them using :martian.core/request
on each request.
For clj-http it looks like you should be able to use :key-store
and :trust-store
and friends.
from martian.
I am using clj-http as suggested. Is there any way I can skip this verification?
I tried with:
(def my-request
{:name ::perform-request
:insecure? true
:insecure true
:leave (fn [{:keys [request] :as ctx}]
(assoc ctx :response (http/request request)))})
(def my-interceptors
(concat martian/default-interceptors [interceptors/default-encode-body interceptors/default-coerce-response my-request]))
(defn authenticate
"Authenticate"
[x u p]
(let [m (martian-http/bootstrap-swagger x my-interceptors)]
(martian/response-for m :Authenticate {:user u :password p})
))
Unfortunately without success.
from martian.
Hi,
You need to set it on the request map that is supplied to clj-http. The following interceptor will do that, you just need to queue it before the http request interceptor.
(def go-insecure
{:name ::perform-request
:enter (fn [ctx]
(assoc-in ctx [:request :insecure?] true))})
Hope this helps.
By the way this is equivalent to your leave fn looking like this:
(fn [{:keys [request] :as ctx}]
(assoc ctx :response (http/request (assoc request :insecure? true))))
But it's quite nice to have interceptors to be smaller so that they're more composable.
from martian.
Hi @koprivica,
If this was useful, shall I close this issue?
Regards,
from martian.
Hi @oliyh,
This was very helpful.
from martian.
Related Issues (20)
- Can you use a spec file directly without a url? HOT 5
- Error from simple spec file. HOT 4
- Interceptors for session authentication HOT 2
- spec file with 404 response defined as json gets exception from clj-http HOT 2
- Switch integration test to petstore.swagger.io
- Add support for AsyncAPI HOT 3
- Bootstrapping relative url for a swagger api from cljs doesn't work
- Unable to use martian over spotinst API HOT 4
- Use clj-commons/clj-http-lite? HOT 5
- Unclear how to use query-params when bootstrapping without openapi/swagger HOT 6
- Is it possible to use a file:// url for the openapi deifinition? HOT 2
- Can't find a way to use $ref parameters HOT 3
- Throw an exception on status code >= 400 or :error HOT 2
- VCR playback should terminate if it has a response
- Invalid cookie header HOT 3
- Exception when generating no content response HOT 1
- No matching content-type available for `application-json` HOT 6
- Endpoint with content type of application/yaml does not seem to be supported HOT 1
- Adding custom encoder does not get chosen if there is a mix of reply contents that include at least one of the default encodings.
- Misled by using martian-test with martian-http/bootstrap HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from martian.