Giter Site home page Giter Site logo

Comments (5)

oliyh avatar oliyh commented on May 8, 2024

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.

koprivica avatar koprivica commented on May 8, 2024

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.

oliyh avatar oliyh commented on May 8, 2024

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.

oliyh avatar oliyh commented on May 8, 2024

Hi @koprivica,
If this was useful, shall I close this issue?
Regards,

from martian.

koprivica avatar koprivica commented on May 8, 2024

Hi @oliyh,
This was very helpful.

from martian.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.