Make the headers a function.
This commit is contained in:
parent
6710acc1b9
commit
a36202b167
|
@ -7,8 +7,9 @@
|
|||
(def api-config (atom {:api-host "https://api.sendgrid.com/"
|
||||
:api-key (h/get-env "SENDGRID_API_KEY" "NO API KEY SUPPLIED")}))
|
||||
|
||||
(def default-authed-payload {:headers {"Authorization" (str "Bearer " (:api-key @api-config))
|
||||
"content-type" "application/json"}})
|
||||
(defn default-authed-payload []
|
||||
{:headers {"Authorization" (str "Bearer " (:api-key @api-config))
|
||||
"content-type" "application/json"}})
|
||||
|
||||
(defn init-config [cfg]
|
||||
(reset! api-config (merge @api-config cfg)))
|
||||
|
@ -19,7 +20,7 @@
|
|||
(defn send-email
|
||||
"https://docs.sendgrid.com/api-reference/mail-send/mail-send"
|
||||
[email]
|
||||
(merge default-authed-payload
|
||||
(merge (default-authed-payload)
|
||||
{:uri (build-url "/mail/send")
|
||||
:method :post
|
||||
:format (json-request-format)
|
||||
|
|
Loading…
Reference in New Issue