babashka / http-client

HTTP client for Clojure and Babashka built on java.net.http
MIT License
126 stars 14 forks source link

http proxy configuration #23

Closed matteoredaelli closed 1 year ago

matteoredaelli commented 1 year ago

Hello, how / where can I configure an http proxy?

I tried

  (http/get url
            {:headers {"Accept" "application/json"
                       "Authorization" (-> context :headers :Authorization)}
             :client (http/client {:proxy {:proxyHost "proxyzscaler.mycompany.com" :proxyPort 80}})}  

but I get

 --- clojure.lang.PersistentArrayMap cannot be cast to java.net.ProxySelector

Many thanks Matteo

borkdude commented 1 year ago

Hi @matteoredaelli, I think you can pass:

(java.net.ProxySelector/of (java.net.InetSocketAddress. "https://foobar.net" 8080))

to the :proxy value, but we should definitely make this easier.