I wanted to use a decision point :media-type-available? but I failed...
I know I have to set the :representation :media-type but I don't really know how to do it.
So far, my code looks as the following:
(defresource test-resource []
:media-type-available (fn [req]
(assoc req :representation {:media-type "application/json"}))
:available-media-types ["application/json" "text/html"]
:handle-ok (fn [req] {:ok true})
)
Remarks:
(assoc req :representation {:media-type "application/json"})produces a correct map with "changed"reqobject.- in
:handle-ok'sreqobject, the:representationvalue is{}
I have no idea how to set it (it's not a mutable object, is it?) and looking at the liberator's source code doesn't really help...
Thanks, Karol
OK... It was just a typo... Instead of
:representationI had:represenation...So if anybody interested, there are two ways of solving this:
return
reqobject with merged:representation:return only the
:representationobject: