Yes, Gary,

I fix it and now everything works fine :).

Thanks

On Fri, Aug 14, 2015 at 8:45 AM, Gary Verhaegen <[email protected]>
wrote:

> It's difficult to tell without the server code, but I think this is a
> misunderstanding about what HTTP params are. In your manual case, you
> are sending "www-url-encoded post params", while in your cljs example
> you're sending a request with an EDN body. These two approaches yield
> very different HTTP requests at the wire level, and your server code
> has to unpack them differently. Depending on your Ring wrappers, the
> EDN you send from cljs will probably be in the :body (not :params)
> attribute of the ring request, and may be either a Clojure map or a
> string.
>
> On 12 August 2015 at 15:31, Édipo Luis Féderle <[email protected]>
> wrote:
> > On Wednesday, August 12, 2015 at 10:15:46 AM UTC-3, Édipo Luis Féderle
> wrote:
> >> Hello again,
> >>
> >> I am working with base om tutorial by David Nolen*. But I am with a
> problem when I try send a POST to my back-end. Basically I use the same
> code from om tutorial. I test back-end separately e it works as expects:
> >>
> >> curl -X POST -d "foo=bar" http://localhost:10555/posts
> >> Params: {:foo "bar"}%
> >>
> >> Bu when I trying from ClojureScript the params is empty. I do:
> >>
> >> Code from Om tutorial:
> >>
> >> (def ^:private meths
> >>   {:get "GET"
> >>    :put "PUT"
> >>    :post "POST"
> >>    :delete "DELETE"})
> >>
> >> (defn edn-xhr [{:keys [method url data on-complete]}]
> >>   (let [xhr (XhrIo.)]
> >>     (events/listen xhr goog.net.EventType.COMPLETE
> >>       (fn [e]
> >>         (on-complete (reader/read-string (.getResponseText xhr)))))
> >>     (. xhr
> >>       (send url (meths method) (when data (pr-str data))
> >>         #js {"Content-Type" "application/edn"}))))
> >>
> >> The request:
> >>
> >>   (edn-xhr
> >>    {:method :post
> >>     :url (str "posts")
> >>     :data {:name "Foo Bar"}
> >>     :on-complete
> >>     (fn [res]
> >>       (println "server response:" res))})
> >>   )
> >>
> >> ;;=> server response:
> >>
> >> I don't figured out whats is the problem here. If I missed some
> important information in this post, please, let me know.
> >>
> >> Thanks in advance.
> >
> > David Nolen*
> >
> > On Wednesday, August 12, 2015 at 10:15:46 AM UTC-3, Édipo Luis Féderle
> wrote:
> >> Hello again,
> >>
> >> I am working with base om tutorial by David Nolan. But I am with a
> problem when I try send a POST to my back-end. Basically I use the same
> code from om tutorial. I test back-end separately e it works as expects:
> >>
> >> curl -X POST -d "foo=bar" http://localhost:10555/posts
> >> Params: {:foo "bar"}%
> >>
> >> Bu when I trying from ClojureScript the params is empty. I do:
> >>
> >> Code from Om tutorial:
> >>
> >> (def ^:private meths
> >>   {:get "GET"
> >>    :put "PUT"
> >>    :post "POST"
> >>    :delete "DELETE"})
> >>
> >> (defn edn-xhr [{:keys [method url data on-complete]}]
> >>   (let [xhr (XhrIo.)]
> >>     (events/listen xhr goog.net.EventType.COMPLETE
> >>       (fn [e]
> >>         (on-complete (reader/read-string (.getResponseText xhr)))))
> >>     (. xhr
> >>       (send url (meths method) (when data (pr-str data))
> >>         #js {"Content-Type" "application/edn"}))))
> >>
> >> The request:
> >>
> >>   (edn-xhr
> >>    {:method :post
> >>     :url (str "posts")
> >>     :data {:name "Foo Bar"}
> >>     :on-complete
> >>     (fn [res]
> >>       (println "server response:" res))})
> >>   )
> >>
> >> ;;=> server response:
> >>
> >> I don't figured out whats is the problem here. If I missed some
> important information in this post, please, let me know.
> >>
> >> Thanks in advance.
> >
> > --
> > 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 a topic in the
> Google Groups "ClojureScript" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojurescript/ddwLLRIygiE/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
>



-- 
http://edipofederle.github.com
@edipofederle

-- 
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.

Reply via email to