Fork me on GitHub
#ring
<
2023-01-03
>
Santiago14:01:09

I was having issues with reitit parameter parsing so I reverted to compojure for some sanity checks and the same thing is happening:

(http/run-server
             (routes
              (-> router/routes ;; compojure (defroutes ...)
                  (wrap-defaults (-> site-defaults
                                     (assoc-in [:session :cookie-attrs :same-site] :lax)
                                     (assoc-in [:security :anti-forgery] false)))))
             {:port port :join? false}))))
the resulting :form-params are not keywordized, even though the site-defaults have it as true . Adding an explicit (assoc-in [:params :keywordize] true) did not change this output. Since this is happening with both reitit and compojure on my machine, could it be a ring issue? Maybe some other lib? I have no other middleware at all

jumar12:01:49

From the wrap-keyword-params docstring: https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/middleware/keyword_params.clj#L37-L42

(defn wrap-keyword-params
  "Middleware that converts the any string keys in the :params map to keywords.
  Only keys that can be turned into valid keywords are converted.

  This middleware does not alter the maps under :*-params keys. These are left
  as strings.