Fork me on GitHub
#reitit
<
2019-09-10
>
Binita Bharati12:09:17

Hi, I am unable to see my POST form data on the corresponding ring handler. I can see that the UI is sending the form data as expected.But, on the handler end, when I print the incoming request, I can not find any trace of the sent form data. The code is as below :

(def app
  (ring/ring-handler
    (ring/router
      [["/loginsubmit" {:name ::loginsubmit
                 :post loginsubmit}]
       ["/assets/*" (ring/create-resource-handler)]])
      (ring/create-default-handler)
      {:middleware [session/wrap-session]}))

(defn loginsubmit [request]
  (println "loginsubmit handler : entered with "request)
   {     :status 200
         :headers {"Content-Type" "text/html"}
         :body "hello"

    })
In my loginsubmit handler, when I print the request, the form data is not present. UI is sending the form data , and I am also able to get the response "hello". But, how, do I receive the form data parameters from the request ?

ikitommi12:09:30

@binita.bharati do you have the parameters-middleware mounted?

ikitommi12:09:44

It reads the form params

Binita Bharati12:09:09

@ikitommi - Thanks! After applying reitit.ring.middleware.parameters/parameters-middleware, I could see the form data in the request.

👍 4