Module: HTTPX::Plugins::Compression

Extended by:
Registry
Defined in:
lib/httpx/plugins/compression.rb,
lib/httpx/plugins/compression/gzip.rb,
lib/httpx/plugins/compression/brotli.rb,
lib/httpx/plugins/compression/deflate.rb

Overview

This plugin adds compression support. Namely it:

  • Compresses the request body when passed a supported “Content-Encoding” mime-type;

  • Decompresses the response body from a supported “Content-Encoding” mime-type;

It supports both gzip and deflate.

gitlab.com/honeyryderchuck/httpx/wikis/Compression

Defined Under Namespace

Modules: Brotli, Deflate, GZIP, RequestBodyMethods, RequestMethods, ResponseBodyMethods Classes: Decoder, Encoder

Constant Summary

Constants included from Registry

Registry::Error

Class Method Summary collapse

Methods included from Registry

extended, included

Class Method Details

.extra_options(options) ⇒ Object



22
23
24
# File 'lib/httpx/plugins/compression.rb', line 22

def self.extra_options(options)
  options.merge(headers: { "accept-encoding" => Compression.registry.keys })
end

.load_dependencies(klass) ⇒ Object



17
18
19
20
# File 'lib/httpx/plugins/compression.rb', line 17

def self.load_dependencies(klass)
  klass.plugin(:"compression/gzip")
  klass.plugin(:"compression/deflate")
end