kit-clj / kit-clj.github.io

Kit documentation
https://kit-clj.github.io/
20 stars 27 forks source link

"Handling file uploads" example wrong key #29

Closed Tsuribori closed 2 years ago

Tsuribori commented 2 years ago

Regarding the "Handling file uploads" code example

https://github.com/kit-clj/kit-clj.github.io/blob/3ee6e6952c67c7cd4fa7f25d357d2f182873b4d3/resources/md/routes.md?plain=1#L147-L157

With

ring/ring-core {:mvn/version "1.9.5"}
ring/ring-defaults {:mvn/version "0.3.3"}

there is no :parameters key but rather the following

(:reitit.core/match :reitit.core/router :protocol :cookies :remote-addr :params :flash :headers :server-port :content-length :form-params :websocket? :session/key :server-exchange :query-params :content-type :character-encoding :context :uri :server-name :anti-forgery-token :query-string :path-params :body :multipart-params :scheme :request-method :session)

The :multipart-params contains the parameters in string-key form while the same things are in :params in keyword-key form. This seems to be because ring-defaults doesn't do anything to :multipart-params.

Should the example be fixed to using :params?

yogthos commented 2 years ago

Good catch, Reitit uses :parameters, but Ring middleware for multipart params uses a :params key.