【发布时间】:2015-05-05 15:55:07
【问题描述】:
我有这样的代码:
(defresource errors []
:authorized? (fn [ctx] (authorized? ctx))
:allowed-methods [:post :options]
:available-media-types media-types
:post! (fn [ctx] (-> ctx
parse-json
errors/insert-error)))
授权?函数检查用户令牌,但我还有一些其他规则,我想在帖子中检查!功能。怎么做?我可以从帖子中抛出异常!函数,但我想返回 401 状态码。
【问题讨论】: