Hi,
I picked up the example shown here 
- 
http://dimagog.github.io/blog/clojure/clojurescript/2013/07/12/making-http-requests-from-clojurescript-with-core.async/
 
to send HTTP requests from cljs. However, I am unsure how to add custom 
headers to the request.

(defn GET [url]
  (let [ch (chan 1)]
    (xhr/send url
              (fn [event]
                (let [res (-> event .-target .getResponseText)]
                  (go (>! ch res)
                      (close! ch)))) "POST" "1234" {"Content-Type" 
"application/json"})
    ch))

Things work as expected when I add the method ("POST") and body ("1234"). 
However, when I add the header (ofcourse, I send a map which is just a 
guess), I notice that an "OPTIONS" request is sent first (which I gather is 
expected).

I am looking for a way to send HTTP requests with custom headers - 
(hopefully, without having to install another library).

Regards,
Kashyap

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to