1
我正在使用liberator使用Clojure构建API。鉴于后续代码:PUT时渲染资源
(defresource single-customer [id]
:allowed-methods [:get, :put]
:exists? (fn [_]
(let [e (get @cust/customers (keyword id))]
(if-not (nil? e)
{::entry e})))
:existed? (fn [_] (nil? (get @cust/customers (keyword id) ::sentinel)))
:available-media-types ["application/json"]
:can-put-to-missing? false
:put! (fn [q] (cust/set-as-fraudulent id))
:handle-ok ::entry)
当有人能告诉我,如果有可能,如GET请求,当我发送一个PUT请求就被重定向到资源? "/customer/1"
(例如)?
谢谢@xsc,下次我会检查决定图:) – elf