1

我收到了一个我不知道如何处理的环形流响应。

我将一个参数传递给我的 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}

谢谢

4

1 回答 1

0

在定义应用程序处理程序时添加(wrap-params)中间件可能会有所帮助。ring.middleware.params

它应该产生一个可访问的:params字段,您可以在请求处理程序中使用该字段。

于 2017-03-02T13:01:39.220 回答