Sha256: f3f42f4807f0b389112825344d9b35c7c42b88284c26b59a04eb72646ab7fd9b

Contents?: true

Size: 1018 Bytes

Versions: 62

Compression:

Stored size: 1018 Bytes

Contents

# frozen_string_literal: true

module Faraday
  # ProxyOptions contains the configurable properties for the proxy
  # configuration used when making an HTTP request.
  class ProxyOptions < Options.new(:uri, :user, :password)
    extend Forwardable
    def_delegators :uri, :scheme, :scheme=, :host, :host=, :port, :port=,
                   :path, :path=

    def self.from(value)
      case value
      when String
        # URIs without a scheme should default to http (like 'example:123').
        # This fixes #1282 and prevents a silent failure in some adapters.
        value = "http://#{value}" unless value.include?('://')
        value = { uri: Utils.URI(value) }
      when URI
        value = { uri: value }
      when Hash, Options
        if (uri = value.delete(:uri))
          value[:uri] = Utils.URI(uri)
        end
      end

      super(value)
    end

    memoized(:user) { uri&.user && Utils.unescape(uri.user) }
    memoized(:password) { uri&.password && Utils.unescape(uri.password) }
  end
end

Version data entries

62 entries across 58 versions & 9 rubygems

Version Path
faraday-1.10.4 lib/faraday/options/proxy_options.rb
avalara_sdk-24.2.29 vendor/bundle/ruby/2.7.0/gems/faraday-1.10.3/lib/faraday/options/proxy_options.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/faraday-2.7.4/lib/faraday/options/proxy_options.rb
zilla-0.2.0 vendor/bundle/ruby/3.2.0/gems/faraday-2.7.4/lib/faraday/options/proxy_options.rb
faraday-2.7.4 lib/faraday/options/proxy_options.rb
faraday-1.10.3 lib/faraday/options/proxy_options.rb
faraday-2.7.3 lib/faraday/options/proxy_options.rb
faraday-2.7.2 lib/faraday/options/proxy_options.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/faraday-2.5.2/lib/faraday/options/proxy_options.rb
faraday-2.7.1 lib/faraday/options/proxy_options.rb
faraday-2.7.0 lib/faraday/options/proxy_options.rb
faraday-2.6.0 lib/faraday/options/proxy_options.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/faraday-2.5.2/lib/faraday/options/proxy_options.rb
faraday-1.10.2 lib/faraday/options/proxy_options.rb
faraday-2.5.2 lib/faraday/options/proxy_options.rb
faraday-2.5.1 lib/faraday/options/proxy_options.rb
faraday-2.5.0 lib/faraday/options/proxy_options.rb
faraday-1.10.1 lib/faraday/options/proxy_options.rb
faraday-2.4.0 lib/faraday/options/proxy_options.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/faraday-2.3.0/lib/faraday/options/proxy_options.rb