我收到一个环流响应,我不知道如何处理。
我向ajax POST传递了一个参数,当它到达compojure路由中的函数时,我得到的是一个环流响应,而不是我传递的原始参数
{:remote-addr 0:0:0:0:0:0:0:1,
:params nil,
:route-params nil,
:headers {origin http://localhost:3300
host localhost:3300
user-agent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/55.0.2883.87 Chrome/55.0.2883.87 Safari/537.36
content-type application/transit+json
content-length 42
referer http://localhost:3300/view
connection keep-alive
accept application/transit+json, application/transit+transit, application/json, text/plain, text/html, */*
accept-language en-GB,en-US;q=0.8,en;q=0.6
accept-encoding gzip, deflate, br}
:server-port 3300
:keep-alive? true
:uri /add-user!
:server-name ip6-localhost
:query-string nil
:body << stream: {:pending-puts 0
:drained? false
:buffer-size 42
:permanent? false
:type netty
:sink? true
:closed? true
:pending-takes 0
:buffer-capacity 16384
:connection {:local-address ip6-localhost/0:0:0:0:0:0:0:1:3300
:remote-address /0:0:0:0:0:0:0:1:34448
:writable? true
:readable? true
:closed? false
:direction :inbound}
:source? true} >>
:scheme :http
:request-method :post}这一切为什么要发生?
主体(我相信我的参数所在的位置)是
<< stream: {:pending-puts 0
:drained? false
:buffer-size 42
:permanent? false
:type netty
:sink? true
:closed? true
:pending-takes 0
:buffer-capacity 16384
:connection {:local-address ip6-localhost/0:0:0:0:0:0:0:1:3300
:remote-address /0:0:0:0:0:0:0:1:34448
:writable? true
:readable? true
:closed? false
:direction :inbound}
:source? true} >>我该如何处理这个问题才能得到我的参数呢?
我的参数应采用{:id id :pass pass}形式
谢谢
发布于 2017-03-02 21:01:39
在定义应用程序处理程序时,从ring.middleware.params添加(wrap-params)中间件可能会有所帮助。
它应该产生一个可访问的:params字段,您可以在请求处理程序中使用该字段。
https://stackoverflow.com/questions/42537125
复制相似问题