Closed timgilbert closed 8 years ago
:format-options
works for wrap-restuful-response
, use :response-options
with wrap-restful-format
.
Ah, thanks for the pointer @Deraen. Digging a little deeper into the code, it looks as though there actually is no way to get pretty-printed JSON, since the value of (:pretty options)
is always overridden by the first parameter to (make-json-encoder)
:
Any particular reason for this? If not, would you be open to a PR to revert this behavior but still default to non-pretty printed output?
Looks like a bug I missed when introducing support for providing options to Cheshire. PR welcome.
(merge {:pretty pretty} options)
should work and a test to check pretty JSON output would be great.
Very similar to this change in fact: https://github.com/ngrunwald/ring-middleware-format/commit/8976b285aa3175f729603ec2a0067ae57db2d37e
Fix merged.
Hi. This is more of a question than an issue - I can see that there is a way to pass options to the various specific formatters, but I can't seem to figure out the right argument structure to actually get them recognized. What I'd like to do is get the JSON response output pretty-printed. I've tried this:
...but it doesn't seem to have an effect, and I'm getting a little lost trying to trace the arguments through the source code.
An example would be really helpful here - I'm happy to submit a PR for the README if someone can help me out. Thanks!