Clojure 为什么我在使用friend/authenticated作为包装器的路由上获得java.lang.exception无法识别的正文?
我正在使用friend和friend redis令牌,其中会话存储在我的compojure应用程序的redis中 对于一条类似于Clojure 为什么我在使用friend/authenticated作为包装器的路由上获得java.lang.exception无法识别的正文?,clojure,compojure,Clojure,Compojure,我正在使用friend和friend redis令牌,其中会话存储在我的compojure应用程序的redis中 对于一条类似于 (POST "/service/logout" {headers :headers} (session/invalidate-session (headers "x-auth-token"))) 一切正常 只要我用friend/authenticated包装处理程序。 我得到了错误 :WARN:oejs.Abstract
(POST "/service/logout" {headers :headers}
(session/invalidate-session
(headers "x-auth-token")))
一切正常
只要我用friend/authenticated包装处理程序。
我得到了错误
:WARN:oejs.AbstractHttpConnection:/service/logout
java.lang.Exception: Unrecognized body: ...
我正在使用以下中间件:
(jsonware/wrap-json-body)
(jsonware/wrap-json-params)
(jsonware/wrap-json-response)
要将body中的所有内容转换为JSON,是否会与friend冲突?我相信问题可能在于
session/invalidatesession
的返回值。因此,请尝试以下方法:
(POST "/service/logout" {headers :headers}
(do (session/invalidate-session
(headers "x-auth-token"))
""))
Compojure试图巧妙地利用路由的返回值做正确的事情,这通常会导致这样的问题。
jsonware
到底是什么?它是json的环形中间件,我刚刚在代码中将其重命名为jsonware。