wrap-json-body and :allowed?

46 views
Skip to first unread message

Matt Mower

unread,
May 28, 2015, 9:12:58 AM5/28/15
to clojure-...@googlegroups.com
Hi.

I'm using Liberator 0.13 with ring-json 0.3.1 and wrap-json-body so I can refer to POST'd content as {{body :body} :request}.

What I've noticed is that in, for example, the :allowed? handler function, the body is still a ByteArrayInputStream. By :post! it's a Clojure map.

My handler is setup as:

  (def app
  (-> (routes home-routes app-routes)

                       (wrap-base-url)

                       (wrap-json-body)

                       (handler/site)
))

any chance I've made a rookie mistake? How can I get wrap-json-body to occur before :allowed? is processed?

Kind regards,

Matt




Philipp Meier

unread,
Jun 9, 2015, 3:29:23 AM6/9/15
to clojure-...@googlegroups.com
Hi Matt,


Am Donnerstag, 28. Mai 2015 15:12:58 UTC+2 schrieb Matt Mower:
 
I'm using Liberator 0.13 with ring-json 0.3.1 and wrap-json-body so I can refer to POST'd content as {{body :body} :request}.

What I've noticed is that in, for example, the :allowed? handler function, the body is still a ByteArrayInputStream. By :post! it's a Clojure map.

My handler is setup as:

  (def app
  (-> (routes home-routes app-routes)

                       (wrap-base-url)

                       (wrap-json-body)

                       (handler/site)
))
 
That looks weird. Can you post an example liberator resource which shows the described behavior?

-billy.
Reply all
Reply to author
Forward
0 new messages