Sha256: 60199b794dd40b5eb16b4ff0e16d5b0e7c4b0ac41c640b9473fbb96c0c5e9ad8

Contents?: true

Size: 934 Bytes

Versions: 27

Compression:

Stored size: 934 Bytes

Contents

# frozen_string_literal: true

module HTTPX
  unless ENV.keys.grep(/\Ahttps?_proxy\z/i).empty?
    proxy_session = plugin(:proxy)
    remove_const(:Session)
    const_set(:Session, proxy_session.class)

    # redefine the default options static var, which needs to
    # refresh options_class
    options = proxy_session.class.default_options.to_hash
    original_verbosity = $VERBOSE
    $VERBOSE = nil
    const_set(:Options, proxy_session.class.default_options.options_class)
    options[:options_class] = Class.new(options[:options_class])
    options.freeze
    Options.send(:const_set, :DEFAULT_OPTIONS, options)
    Session.instance_variable_set(:@default_options, Options.new(options))
    $VERBOSE = original_verbosity
  end

  # :nocov:
  if Session.default_options.debug_level > 2
    proxy_session = plugin(:internal_telemetry)
    remove_const(:Session)
    const_set(:Session, proxy_session.class)
  end
  # :nocov:
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
httpx-1.0.0 lib/httpx/session_extensions.rb
httpx-0.24.6 lib/httpx/session_extensions.rb
httpx-0.24.5 lib/httpx/session_extensions.rb
httpx-0.24.4 lib/httpx/session_extensions.rb
httpx-0.24.3 lib/httpx/session_extensions.rb
httpx-0.24.2 lib/httpx/session_extensions.rb
httpx-0.24.1 lib/httpx/session_extensions.rb