- Notifications
You must be signed in to change notification settings - Fork2
The Gzip middleware for Faraday 1 and 2 adds the necessary Accept-Encoding headers and automatically decompresses the response
License
bodrovis/faraday-gzip
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
TheGzip
middleware for Faraday 1 and 2 adds the necessaryAccept-Encoding
headers and automatically decompresses the response. If the "Accept-Encoding" header isn't set in the request, it defaults togzip,deflate
and appropriately handles the server's compressed response. This functionality resembles what Ruby does internally inNet::HTTP#get
. IfBrotli is included in your Gemfile, the middleware also addsbr
to the header for Brotli support.
- faraday-gzip v3 supports only Faraday v2 and is tested with Ruby 3.0+ and JRuby 9.4
- faraday-gzip v2 supports Faraday v1 and v2 and is tested with Ruby 2.7+ and JRuby 9.4.
Add this line to your application's Gemfile:
gem'faraday-gzip','~> 3'
And then execute:
bundle install
Or install it yourself as:
gem install faraday-gzip
To enable the middleware in your Faraday connection, add it as shown below:
require'faraday/gzip'# <=== Add this lineconn=Faraday.new(...)do |f|f.request:gzip# <=== Add this line# Additional configuration...end
To contribute or make changes:
- Clone the repo
- Run
bundle
to install dependencies - Implement your feature
- Write and run tests using
rspec .
- Use rake build to build the gem locally if needed
- Create a new PR with your changes
Bug reports and pull requests are welcome on GitHub.
This gem is available as open source under the terms of theMIT License.
About
The Gzip middleware for Faraday 1 and 2 adds the necessary Accept-Encoding headers and automatically decompresses the response