Autobot::HTTP
Centralized HTTP utility for managing HTTP::Client instances, timeouts, proxy routing, and deterministic exception-safe socket closure.
Constants
DEFAULT_DNS_TIMEOUT = 10.seconds
DEFAULT_READ_TIMEOUT = 30.seconds
Log = ::Log.for("autobot.http")
REQUEST_CONNECT_TIMEOUT = 10.seconds
Class methods
Applies an HTTP proxy to the given client instance.
build_client(uri : URI | String, connect_timeout : Time::Span = REQUEST_CONNECT_TIMEOUT, read_timeout : Time::Span | Nil = DEFAULT_READ_TIMEOUT, dns_timeout : Time::Span | Nil = DEFAULT_DNS_TIMEOUT) : ::HTTP::Client
Constructs an HTTP::Client configured with standard timeouts.
Executes a block with a provided HTTP::Client, guaranteeing socket closure via ensure.
with_client(uri : URI | String, proxy : String | Nil = nil, connect_timeout : Time::Span = REQUEST_CONNECT_TIMEOUT, read_timeout : Time::Span | Nil = DEFAULT_READ_TIMEOUT, dns_timeout : Time::Span | Nil = DEFAULT_DNS_TIMEOUT, &)
Executes a block with an HTTP::Client constructed from uri, guaranteeing socket closure via ensure.