ring-clojure / ring-json

Ring middleware for handling JSON
313 stars 47 forks source link

Exception Handling For Malformed JSON In Body #26

Closed dyba closed 10 years ago

dyba commented 10 years ago
weavejester commented 10 years ago

I'm not quite sure what you expect this to do. You're assigning a :status key to the request, rather than the response, so this middleware won't have any effect if there is malformed JSON. Your try-catch is also too wide - you're encompassing the handler, rather than the read-json only.

I think I'm leaning toward using a option for this that contains a function, similar to #11, but without the problems I outline.

dyba commented 10 years ago

Oh, I guess I was working off some wrong assumptions about how ring is used. I'll take a look at your comments again on #11 and see if I can provide a solution that addresses the problems you raised.