Method: HTTPX::Options#initialize
- Defined in:
- lib/httpx/options.rb
#initialize(options = {}) ⇒ Options
Returns a new instance of Options.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/httpx/options.rb', line 42 def initialize( = {}) defaults = { :debug => ENV.key?("HTTPX_DEBUG") ? $stderr : nil, :debug_level => (ENV["HTTPX_DEBUG"] || 1).to_i, :ssl => {}, :http2_settings => { settings_enable_push: 0 }, :fallback_protocol => "http/1.1", :timeout => Timeout.new, :headers => {}, :max_concurrent_requests => MAX_CONCURRENT_REQUESTS, :window_size => WINDOW_SIZE, :body_threshold_size => MAX_BODY_THRESHOLD_SIZE, :request_class => Class.new(Request), :response_class => Class.new(Response), :headers_class => Class.new(Headers), :request_body_class => Class.new(Request::Body), :response_body_class => Class.new(Response::Body), :connection_class => Class.new(Connection), :transport => nil, :transport_options => nil, :persistent => false, :resolver_class => (ENV["HTTPX_RESOLVER"] || :native).to_sym, } defaults.merge!() defaults[:headers] = Headers.new(defaults[:headers]) defaults.each { |(k, v)| self[k] = v } end |