module

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

apply_proxy(client : ::HTTP::Client, proxy_url : String) : Nil

Applies an HTTP proxy to the given client instance.

Source
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.

Source
with_client(client : ::HTTP::Client, proxy : String | Nil = nil, &)

Executes a block with a provided HTTP::Client, guaranteeing socket closure via ensure.

Source
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.

Source

Nested types