Rails5.x config/initializers/mime_types.rb
Mime::Type.register "gzip/json", :gzipjson
ActionDispatch::Http::Parameters::DEFAULT_PARSERS[:gzipjson] = lambda do |raw_body|
body = ActiveSupport::Gzip.decompress(raw_body)
JSON.parse(body)
end
ActionDispatch::Request.parameter_parsers = ActionDispatch::Request::DEFAULT_PARSERShttp client
- add content type header
Content-Type:gzip/json - add Content encoding header
Content-Encoding:gzip - gzip inflate to request body
- request !!