【发布时间】:2014-09-11 17:43:33
【问题描述】:
我们正在使用clj-http 进行 HTTP 基本身份验证。我想发送一个带有这个标头的请求:
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
我发现的所有示例都说要这样做like this:
(clj-http.client/get "http://my.domain.com"
{:headers {:basic-auth [username password]}})
这似乎发送的请求只包含一个名为basic-auth 的标头,其中username 和password 的值未编码。我必须像这样手动生成基本的身份验证标头:
(clj-http.client/get "http://my.domain.com"
{:headers {:Authorization "Basic dXNlcm5hbWU6cGFzc3dvcmQ="}})
当然,这要困难得多,因为我必须正确编码用户名和密码,并在前面贴上“基本”一词。 clj-http 可以帮我做吗?
【问题讨论】:
标签: clojure basic-authentication