I've implemented a post method as external api which responses large data in json format. How can I use gzip to compress these data to make possible to uncompress by client without any problem? Also I use chrome extension "Advanced REST Client" to make post requests for testing. I made search through internet but found only some short examples such "place config.middleware.use Rack::Deflater into application.rb" or "use Rack::Deflate in config.ru file". Rack::Deflate in config.ru parses all responses from the server and when I tested with chrome extension "Advanced REST Client" it wasnt be parsed to json as well.
Asked
Active
Viewed 1,223 times
0
-
1see here for the compression part: http://stackoverflow.com/questions/16766859/rails-json-response-with-gzip-compression – Cristian Bica Nov 14 '13 at 13:45
-
I've already add config.middleware.use Rack::Deflater into application.rb and also in post request sent Accept-Encoding:gzip. In response I did "return json:[:status => true, data => large_data], content_encoding => "gzip". In Rest client I saw in the Raw resposned data field only json data which has not been compressed. – Zane Nov 14 '13 at 14:14
-
1maybe the browser automatically decompressed the data. Check the chrome inspector – Cristian Bica Nov 14 '13 at 14:34
-
The Chrome Rest Client have "Parsed" tab item to show the parsed values. But I have only "Raw" and "JSON" tab items. – Zane Nov 14 '13 at 14:43
-
I checked the values with inspector but nothing( – Zane Nov 14 '13 at 14:44
-
bcd, thanks for help, its REST client issue. It parsed the data in any case. I tried to use httpie tool and it works fine. – Zane Nov 14 '13 at 15:22