wrap-multipart-params only includes the last value in the vector #37

Closed
ibdknox opened this Issue Oct 10, 2011 · 2 comments

2 participants

@ibdknox

As of Ring 0.3.11, parameters with the same name are no longer being vectorized correctly. The following code will contain only the last value:

(defn nested-test [_]
  (html
     [:head [:title "test"]]
     [:body
        [:form {:action "/submit" :method "POST"}
        [:input {:type :text :name "mything[]" :value "10"}]
        [:input {:type :text :name "mything[]" :value "20"}]
        [:input {:type :submit}]]]))

(defn submit [request]
   (println (request :params)))

Expected:
{:mything ["10" "20"]}

Actual:
{:mything ["20"]}

For complete code and more context see this thread:
https://groups.google.com/d/msg/clj-noir/Hub0ica7X6c/-f22jkEEr0sJ

@weavejester
Collaborator

This is actually a problem with wrap-multipart-params, not wrap-nested-params.

The multipart middleware is not storing parameter values with the same key as a vector.

@ibdknox

Ah whoops, updated the issue to reflect that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment