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