We're using clj-http to do HTTP basic authentication. I want to send a request with this header:
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
All the examples I've found say to do it like this:
(clj-http.client/get "http://my.domain.com"
{:headers {:basic-auth [username password]}})
This seems to send a request that just contains a header called basic-auth
, with unencoded values for username
and password
. I'm having to manually generate the basic auth header like this:
(clj-http.client/get "http://my.domain.com"
{:headers {:Authorization "Basic dXNlcm5hbWU6cGFzc3dvcmQ="}})
Of course, that's much harder because I have to encode the username and password properly and stick the word "Basic" on the front. Can clj-http do this for me?