Hi David, This is not about tutorial, I am using edn-xhr request for my own application. But look like, Google closure lib update request method when XhrIo is used with opt_header and "get".
Br, Mamun On Wednesday, March 5, 2014 3:05:01 PM UTC+1, David Nolen wrote: > Are you saying that the tutorial isn't working or that you're trying to reuse > edn-xhr for some other purpose? > > > David > > > > > On Wed, Mar 5, 2014 at 6:15 AM, Abdullah Mamun <[email protected]> wrote: > > Hi All, > > > > When I send a request using edn-xhr with optional opt_header, I saw wrong > request method is set by XhrIo. > > > > > > -- Not working > > > > (defn edn-xhr [{:keys [url on-complete]}] > > (let [xhr (XhrIo.)] > > (when on-complete > > (events/listen xhr goog.net.EventType.COMPLETE > > (fn [e] > > (.log js/console e) > > (on-complete (reader/read-string (.getResponseText > xhr)))))) > > (.send xhr url "GET" nil #js {"Content-Type" "application/edn"}))) > > > > Browser send log: > > Request URL:http://google.com/ > > Request Method:OPTIONS //Should be GET > > Status Code:405 Method Not Allowed > > > > > > -- Working > > > > (defn edn-xhr [{:keys [url on-complete]}] > > (let [xhr (XhrIo.)] > > (when on-complete > > (events/listen xhr goog.net.EventType.COMPLETE > > (fn [e] > > (.log js/console e) > > (on-complete (reader/read-string (.getResponseText > xhr)))))) > > (.send xhr url "GET" nil #js {}))) //empty opt_header > > > > Browser send log: > > Request URL:http://google.com/ > > Request Method:GET > > Status Code:301 Moved Permanently > > > > -- Request send > > (edn-xhr {:url "http://google.com" > > :on-complete (fn [d] > > (.log (js/console d)) > > )}) > > > > > > > > Looks like js object created by #js macro is not correct for XhrIo > opt_header. In google xhrio doc I saw opt_header should be javaScript Object > or goog.structs.Map. > > > > > > More info: > > Clojurescript version: org.clojure/clojurescript "0.0-2173" > > > > > > Br, > > Mamun > > > > > > > > > > > > -- > > 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 [email protected]. > > To post to this group, send email to [email protected]. > > Visit this group at http://groups.google.com/group/clojurescript. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
