I want to take a large JSON PUT request and process it entirely in the background with Sidekiq. As such, I do not want to automatically parse the incoming JSON from the request's body.
Whats the best practice for accomplishing this on a controller/action-based level?
As far as I know this is done via Rack middleware, so I don't think you can just disable it for one controller/action right out of the box. You can patch ActionDispatch::ParamsParser
similar to what this guy did:
http://www.jkfill.com/2015/02/21/skip-automatic-params-parsing/
You, of course, can write your own middleware that parses the parameters, or specify a custom parser for JSON MIME type.
At last, you can disable the JSON parsing all together. In your config/application.rb add:
config.middleware.swap ActionDispatch::ParamsParser, ActionDispatch::ParamsParser, Mime::JSON => nil
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With