我正在使用liberator使用 Clojure 构建 API。给定以下代码:
(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"
(例如) ?