ruby / net-http

Net::HTTP provides a rich library which can be used to build HTTP user-agents.
Other
97 stars 66 forks source link

Add ability to configure default settings for new connections #177

Closed fatkodima closed 2 months ago

fatkodima commented 4 months ago

Closes #176.

It should be used by something like this:

Net::HTTP.default_configuration = {
  read_timeout: 1,
  write_timeout: 1
}

http = Net::HTTP.new(hostname)
http.open_timeout   # => 60
http.read_timeout   # => 1
http.write_timeout  # => 1

Probably, there is a better name for the new option. And maybe we should allow more options to be configured, let me know.

hsbt commented 2 months ago

Thanks!