如何使用包含api密钥的clj http执行http请求?

如何使用包含api密钥的clj http执行http请求?,api,clojure,clj-http,Api,Clojure,Clj Http,我正在尝试向一个api发出http请求,以改变yoda可能说的句子的方式。下面是我的代码,它当前收到一个包含“缺少Mashape应用程序密钥”的错误: :basic auth部分是该代码中最有问题的部分。api说明位于以下位置: 这就是此api的工作curl请求的样子: curl --get --include 'https://yoda.p.mashape.com/yoda?sentence=You+will+learn+how+to+speak+like+me+someday.++Oh+wa

我正在尝试向一个api发出http请求,以改变yoda可能说的句子的方式。下面是我的代码,它当前收到一个包含“缺少Mashape应用程序密钥”的错误:

:basic auth
部分是该代码中最有问题的部分。api说明位于以下位置: 这就是此api的工作curl请求的样子:

curl --get --include 'https://yoda.p.mashape.com/yoda?sentence=You+will+learn+how+to+speak+like+me+someday.++Oh+wait.' \
  -H 'X-Mashape-Key: *MY-AUTH-KEY-HERE*' \
  -H 'Accept: text/plain'

任何帮助都可能为我节省无数的时间,在谷歌上搜索如何实现这一点的线索。

看起来密钥需要放在一个名为
X-Mashape-key
的特定标题中,而不是使用HTTP basic auth

(client/request
  {:headers {"X-Mashape-Key" "*MY-AUTH-KEY-HERE*"}
   :method method
   :url (str "https://yoda.p.mashape.com" path)
   :content-type "text/plain"
   :body body})))

请关闭第二行打开的支架,以供他人参考。我被抓住了!我没有运行它就发布了代码。我承认羞愧。(现已修复)
(client/request
  {:headers {"X-Mashape-Key" "*MY-AUTH-KEY-HERE*"}
   :method method
   :url (str "https://yoda.p.mashape.com" path)
   :content-type "text/plain"
   :body body})))