Luminus response problem

Hi.

I am following the luminus example tutorial trying to post response from body-params. but I get no response using the following code:

(defn test4 [request]
    (response/ok (str "arg1: " (:path-params request)
                 (str "arg2: " (:params request)
                 (str "arg3: " (:body-params request))))))

(defn home-routes []
    [ "" 
     {:middleware [middleware/wrap-formats]}
     ["/" {:get home-page}]
     ["/t1" {:get (fn [request] {:status 200 :body (keys request)})}]
     ["/about" {:get about-page}]
     ["/test" test-page]
     ["/test2/:id" test2]
     ["/test3/:arg1/:arg2/:arg3" {:post test3}]
     ["/test4/:arg" {:post test4}]
     ["/echo/:id" {:get (fn [{{:keys [id]} :path-params}]
                          (response/ok (str "<p>value: " id "</p>")))}]
     ["/foo/:bar" {:post (fn [{:keys [path-params query-params body-params]}]
                          {:status 200
                           :body   (str "path params: " path-params
                                        "\nquery params: " query-params
                                        "\nbody params: " body-params)})}]
     ])

I am calling curl:

curl --header "Content Type: application/json" --request POST --data '{"username":"xyz","password":"xyz"}' 'localhost:3000/test4/arg?arg=bar'

but no response on the data request. any ideas?

I believe that POST requests are automatically guarded by CSRF protection in basic Ring setups like Luminus uses. Although I would expect you to still get a response in that case.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.