1
votes

I am getting a ring stream response which I do not know how to deal with.

I passed in a parameters to my ajax POST and when it gets to the function in my compojure route, instead of being the original parameter I passed in, I get a ring stream response being

{: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}

Why does this happen?

The body (where I believe my param lies) is

<< 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} >>

How do I deal with this to get my parameter out?

My parameter should be in the form {:id id :pass pass}

Thanks

1
What middleware did you use for your ring server?Aleph Aleph
I am using compojure so I think ring middleware.rbb

1 Answers

0
votes

Adding (wrap-params) middleware from ring.middleware.params when defining your application handler might help.

It should result in an accessible :params field that you can work with in your request handler.