mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-04 00:00:37 -04:00
this may happen in a few contexts, such as connection exhaustion, but more importantly, when a request is retried in a different connection; if the request successfully sets the callbacks before the connection raises an issue and the request is retried in a new one, the callback from the faulty connection are carried with it, and triggered at a time when the connection is back in the connection pool, or worse, used in a different thread this fix relies on :idle transition callback, which is called before request is routed around
75 lines
1.6 KiB
Plaintext
75 lines
1.6 KiB
Plaintext
module HTTPX
|
|
class Request
|
|
extend Forwardable
|
|
include Callbacks
|
|
|
|
METHODS: Array[Symbol]
|
|
USER_AGENT: String
|
|
|
|
attr_reader verb: verb
|
|
attr_reader uri: http_uri
|
|
attr_reader headers: Headers
|
|
attr_reader body: Body
|
|
attr_reader state: Symbol
|
|
attr_reader options: Options
|
|
attr_reader response: response?
|
|
attr_reader drain_error: StandardError?
|
|
attr_reader active_timeouts: Array[Symbol]
|
|
|
|
attr_accessor peer_address: ipaddr?
|
|
|
|
attr_writer persistent: bool
|
|
|
|
@query_params: Hash[interned, untyped]?
|
|
@trailers: Headers?
|
|
@informational_status: Integer?
|
|
@query: String?
|
|
@drainer: Enumerator[String, void]?
|
|
|
|
def initialize: (Symbol | String verb, generic_uri uri, Options options, ?request_params params) -> untyped
|
|
|
|
def interests: () -> (:r | :w)
|
|
|
|
def merge_headers: (_Each[[String, headers_value]]) -> void
|
|
|
|
def scheme: () -> String
|
|
|
|
def response=: (response) -> void
|
|
|
|
def path: () -> String
|
|
|
|
def authority: () -> String
|
|
|
|
def origin: () -> String
|
|
|
|
def query: () -> String
|
|
|
|
def drain_body: () -> String?
|
|
|
|
def inspect: () -> String
|
|
|
|
def transition: (Symbol) -> void
|
|
|
|
def expects?: () -> boolish
|
|
|
|
def trailers: () -> Headers
|
|
|
|
def trailers?: () -> boolish
|
|
|
|
def persistent?: () -> bool
|
|
|
|
def read_timeout: () -> Numeric?
|
|
|
|
def write_timeout: () -> Numeric?
|
|
|
|
def request_timeout: () -> Numeric?
|
|
|
|
def set_timeout_callback: (Symbol event) { (*untyped) -> void } -> void
|
|
|
|
private
|
|
|
|
def initialize_body: (Options options) -> Transcoder::_Encoder?
|
|
|
|
end
|
|
end
|