0.05
The project is in a healthy, maintained state
Faraday plugin to automatically set compression headers (GZip, Deflate, Brotli) and decompress the response.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 13.0
~> 3.0
~> 1.32
~> 0.22

Runtime

>= 1.0
~> 3.0
 Project Readme

Faraday Gzip

CI Gem Gem Total Downloads

The Gzip middleware for Faraday 1 and 2 adds the necessary Accept-Encoding headers and automatically decompresses the response. If the "Accept-Encoding" header wasn't set in the request, this sets it to "gzip,deflate" and appropriately handles the compressed response from the server. This resembles what Ruby does internally in Net::HTTP#get. If Brotli is added to the Gemfile, it will also add "br" to the header.

Prerequisites

This gem is tested with Ruby 2.6+ and JRuby 9.3+. Faraday 1 and 2 is supported.

Installation

Add this line to your application's Gemfile:

gem 'faraday-gzip'

And then execute:

bundle install

Or install it yourself as:

gem install faraday-gzip

Usage

require 'faraday/gzip' # <=== add this line

conn = Faraday.new(...) do |f|
  f.request :gzip # <=== add this line
  #...
end

Development

After checking out the repo, run bin/setup to install dependencies.

Then, run bin/test to run the tests.

To install this gem onto your local machine, run rake build.

To release a new version, make a commit with a message such as "Bumped to 0.0.2" and then run rake release. See how it works here.

Contributing

Bug reports and pull requests are welcome on GitHub.

License

The gem is available as open source under the terms of the MIT License.