]> cat aescling's git repositories - mastodon.git/commitdiff
Support gzip encoding on Request (#7425)
authorYamagishi Kazutoshi <ykzts@desire.sh>
Wed, 9 May 2018 14:59:39 +0000 (23:59 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 9 May 2018 14:59:39 +0000 (16:59 +0200)
app/lib/request.rb

index 00f94dacf5c1f00dae99a10e39ece7aab2fb63e9..fc7d398e04ebdb7a002d3bafb5000825ed8a6ae4 100644 (file)
@@ -51,7 +51,7 @@ class Request
   end
 
   def headers
-    (@account ? @headers.merge('Signature' => signature) : @headers).without(REQUEST_TARGET)
+    (@account ? @headers.merge('Signature' => signature) : @headers).reverse_merge('Accept-Encoding' => 'gzip').without(REQUEST_TARGET)
   end
 
   private
@@ -100,7 +100,7 @@ class Request
   end
 
   def http_client
-    @http_client ||= HTTP.timeout(:per_operation, timeout).follow(max_hops: 2)
+    @http_client ||= HTTP.use(:auto_inflate).timeout(:per_operation, timeout).follow(max_hops: 2)
   end
 
   def use_proxy?