ring-clojure / ring-json

Ring middleware for handling JSON
317 stars 47 forks source link

add :keywords? option to wrap-json-params handler #9

Closed alexott closed 11 years ago

alexott commented 11 years ago

This patch allows to specify :keywors? argument to wrap-json-params handler

P.S. btw, why the explicity map is used for options like:

(wrap-json-params handler {:keywords true})

instead of more standard

(wrap-json-params handler :keywords true)

?

weavejester commented 11 years ago

The wrap-keyword-params already translates parameter names into keywords, so a :keywords? option is unnecessary.

As for why it uses the former syntax instead of the latter, it's because it's much easier to work with option maps when they are not expanded out. Compare:

(wrap-json-params handler options)

To:

(apply wrap-json-params handler (apply concat options))

I should also point out that the former syntax is more commonly used.

weavejester commented 11 years ago

Also, this has been discussed before in #1.

weavejester commented 11 years ago

And in #4 as well...

alexott commented 11 years ago

Thank you for explanation, I'll close the pull request.