Sha256: 8808c5a60054ee141c000f34ccd765e2dad388701d3286a704075362ce78a7e2

Contents?: true

Size: 1.61 KB

Versions: 14

Compression:

Stored size: 1.61 KB

Contents

# frozen_string_literal: true

require "httpx/version"

require "httpx/extensions"

require "httpx/errors"
require "httpx/utils"
require "httpx/punycode"
require "httpx/domain_name"
require "httpx/altsvc"
require "httpx/callbacks"
require "httpx/loggable"
require "httpx/transcoder"
require "httpx/timers"
require "httpx/pool"
require "httpx/headers"
require "httpx/request"
require "httpx/response"
require "httpx/options"
require "httpx/chainable"

# Top-Level Namespace
#
module HTTPX
  EMPTY = [].freeze

  # All plugins should be stored under this module/namespace. Can register and load
  # plugins.
  #
  module Plugins
    @plugins = {}
    @plugins_mutex = Thread::Mutex.new

    # 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.
    #
    def self.load_plugin(name)
      h = @plugins
      m = @plugins_mutex
      unless (plugin = m.synchronize { h[name] })
        require "httpx/plugins/#{name}"
        raise "Plugin #{name} hasn't been registered" unless (plugin = m.synchronize { h[name] })
      end
      plugin
    end

    # Registers a plugin (+mod+) in the central store indexed by +name+.
    #
    def self.register_plugin(name, mod)
      h = @plugins
      m = @plugins_mutex
      m.synchronize { h[name] = mod }
    end
  end

  extend Chainable
end

require "httpx/session"
require "httpx/session_extensions"

# load integrations when possible

require "httpx/adapters/datadog" if defined?(DDTrace) || defined?(Datadog)
require "httpx/adapters/sentry" if defined?(Sentry)
require "httpx/adapters/webmock" if defined?(WebMock)

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
httpx-1.3.4 lib/httpx.rb
httpx-1.3.3 lib/httpx.rb
httpx-1.3.2 lib/httpx.rb
httpx-1.3.1 lib/httpx.rb
httpx-1.3.0 lib/httpx.rb
httpx-1.2.6 lib/httpx.rb
httpx-1.2.4 lib/httpx.rb
httpx-1.2.3 lib/httpx.rb
httpx-1.2.2 lib/httpx.rb
httpx-1.2.1 lib/httpx.rb
httpx-1.2.0 lib/httpx.rb
httpx-1.1.5 lib/httpx.rb
httpx-1.1.4 lib/httpx.rb
httpx-1.1.3 lib/httpx.rb