Module: HTTPX::Plugins

Defined in:
lib/httpx.rb,
lib/httpx/plugins/h2c.rb,
lib/httpx/plugins/proxy.rb,
lib/httpx/plugins/stream.rb,
lib/httpx/plugins/cookies.rb,
lib/httpx/plugins/retries.rb,
lib/httpx/plugins/multipart.rb,
lib/httpx/plugins/proxy/ssh.rb,
lib/httpx/plugins/persistent.rb,
lib/httpx/plugins/proxy/http.rb,
lib/httpx/plugins/compression.rb,
lib/httpx/plugins/proxy/socks4.rb,
lib/httpx/plugins/proxy/socks5.rb,
lib/httpx/plugins/push_promise.rb,
lib/httpx/plugins/authentication.rb,
lib/httpx/plugins/compression/gzip.rb,
lib/httpx/plugins/follow_redirects.rb,
lib/httpx/plugins/compression/brotli.rb,
lib/httpx/plugins/compression/deflate.rb,
lib/httpx/plugins/basic_authentication.rb,
lib/httpx/plugins/digest_authentication.rb

Overview

All plugins should be stored under this module/namespace. Can register and load plugins.

Defined Under Namespace

Modules: Authentication, BasicAuthentication, Compression, Cookies, DigestAuthentication, FollowRedirects, H2C, Multipart, Persistent, Proxy, PushPromise, Retries, Stream

Class Method Summary collapse

Class Method Details

.load_plugin(name) ⇒ Object

Loads a plugin based on a name. If the plugin hasn’t been loaded, tries to load it from the load path under “httpx/plugins/” directory.



34
35
36
37
38
39
40
41
# File 'lib/httpx.rb', line 34

def self.load_plugin(name)
  h = @plugins
  unless (plugin = h[name])
    require "httpx/plugins/#{name}"
    raise "Plugin #{name} hasn't been registered" unless (plugin = h[name])
  end
  plugin
end

.register_plugin(name, mod) ⇒ Object

Registers a plugin (mod) in the central store indexed by name.



45
46
47
# File 'lib/httpx.rb', line 45

def self.register_plugin(name, mod)
  @plugins[name] = mod
end