mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-04 00:00:37 -04:00
added missing options sig
This commit is contained in:
parent
3f9c165d51
commit
71cb66e287
@ -626,8 +626,10 @@ module HTTPX
|
||||
on_error(error)
|
||||
end
|
||||
|
||||
def read_timeout_callback(request, read_timeout, error_type = WriteTimeoutError)
|
||||
return if request.response && request.response.finished?
|
||||
def read_timeout_callback(request, read_timeout, error_type = ReadTimeoutError)
|
||||
response = request.response
|
||||
|
||||
return if response && response.finished?
|
||||
|
||||
@write_buffer.clear
|
||||
error = error_type.new(request, request.response, read_timeout)
|
||||
|
@ -120,6 +120,7 @@ module HTTPX
|
||||
|
||||
def path
|
||||
path = uri.path.dup
|
||||
path = +"" if path.nil?
|
||||
path << "/" if path.empty?
|
||||
path << "?#{query}" unless query.empty?
|
||||
path
|
||||
|
@ -77,7 +77,8 @@ module HTTPX
|
||||
nil
|
||||
rescue Errno::EHOSTUNREACH => e
|
||||
@ns_index += 1
|
||||
if @ns_index < @nameserver.size
|
||||
nameserver = @nameserver
|
||||
if nameserver && @ns_index < nameserver.size
|
||||
log { "resolver: failed resolving on nameserver #{@nameserver[@ns_index - 1]} (#{e.message})" }
|
||||
transition(:idle)
|
||||
else
|
||||
|
@ -28,6 +28,7 @@ module HTTPX
|
||||
attr_reader options: Options
|
||||
attr_writer timers: Timers
|
||||
|
||||
@type: io_type
|
||||
@origins: Array[URI::Generic]
|
||||
@window_size: Integer
|
||||
@read_buffer: Buffer
|
||||
@ -40,7 +41,7 @@ module HTTPX
|
||||
|
||||
def addresses=: (Array[ipaddr]) -> void
|
||||
|
||||
def match?: (URI::Generic, options) -> bool
|
||||
def match?: (URI::Generic uri, Options options) -> bool
|
||||
|
||||
def mergeable?: (Connection) -> bool
|
||||
|
||||
@ -54,13 +55,15 @@ module HTTPX
|
||||
|
||||
def match_altsvcs?: (URI::Generic uri) -> bool
|
||||
|
||||
def match_altsvc_options?: (URI::Generic uri, Options options) -> bool
|
||||
|
||||
def connecting?: () -> bool
|
||||
|
||||
def inflight?: () -> boolish
|
||||
|
||||
def interests: () -> io_interests?
|
||||
|
||||
def to_io: () -> IO
|
||||
def to_io: () -> ::IO
|
||||
|
||||
def call: () -> void
|
||||
|
||||
@ -77,7 +80,7 @@ module HTTPX
|
||||
|
||||
private
|
||||
|
||||
def initialize: (String, URI::Generic, options) -> untyped
|
||||
def initialize: (io_type, URI::Generic, options) -> untyped
|
||||
|
||||
def connect: () -> void
|
||||
|
||||
@ -106,8 +109,8 @@ module HTTPX
|
||||
|
||||
def set_request_timeouts: (Request request) -> void
|
||||
|
||||
def write_timeout_callback: (Request request, Numeric write_timeout)
|
||||
def write_timeout_callback: (Request request, Numeric write_timeout) -> void
|
||||
|
||||
def read_timeout_callback: (Request request, Numeric read_timeout, singleton(RequestTimeoutError) error_type)
|
||||
def read_timeout_callback: (Request request, Numeric read_timeout, ?singleton(RequestTimeoutError) error_type) -> void
|
||||
end
|
||||
end
|
@ -20,7 +20,7 @@ module HTTPX
|
||||
class SettingsTimeoutError < TimeoutError
|
||||
end
|
||||
|
||||
class ResolveTimeoutError < RequestTimeoutError
|
||||
class ResolveTimeoutError < TimeoutError
|
||||
end
|
||||
|
||||
class RequestTimeoutError < TimeoutError
|
||||
@ -30,7 +30,7 @@ module HTTPX
|
||||
def initialize: (Request request, response? response, Numeric timeout) -> void
|
||||
end
|
||||
|
||||
class ReadTimeoutError < TimeoutError
|
||||
class ReadTimeoutError < RequestTimeoutError
|
||||
end
|
||||
|
||||
class WriteTimeoutError < RequestTimeoutError
|
||||
|
6
sig/io.rbs
Normal file
6
sig/io.rbs
Normal file
@ -0,0 +1,6 @@
|
||||
module HTTPX
|
||||
type io_type = "udp" | "tcp" | "ssl" | "unix"
|
||||
|
||||
module IO
|
||||
end
|
||||
end
|
@ -65,6 +65,9 @@ module HTTPX
|
||||
# body
|
||||
attr_reader origin: URI::Generic?
|
||||
|
||||
# base_path
|
||||
attr_reader base_path: String?
|
||||
|
||||
# ssl
|
||||
|
||||
# http2_settings
|
||||
|
@ -10,7 +10,10 @@ module HTTPX
|
||||
@family: ip_family
|
||||
@options: Options
|
||||
@ns_index: Integer
|
||||
@nameserver: String
|
||||
@nameserver: Array[String]?
|
||||
@ndots: Integer
|
||||
@start_timeout: Numeric?
|
||||
@search: Array[String]
|
||||
@_timeouts: Array[Numeric]
|
||||
@timeouts: Hash[String, Array[Numeric]]
|
||||
@connections: Array[Connection]
|
||||
@ -37,7 +40,7 @@ module HTTPX
|
||||
|
||||
def consume: () -> void
|
||||
|
||||
def do_retry: (?Numeric loop_time) -> void
|
||||
def do_retry: (?Numeric? loop_time) -> void
|
||||
|
||||
def dread: (Integer) -> void
|
||||
| () -> void
|
||||
|
@ -1,5 +1,7 @@
|
||||
module HTTPX
|
||||
interface _Response
|
||||
def finished?: () -> bool
|
||||
|
||||
def raise_for_status: () -> self
|
||||
|
||||
def error: () -> StandardError?
|
||||
|
@ -109,6 +109,7 @@ class OptionsTest < Minitest::Test
|
||||
keep_alive_timeout: 20,
|
||||
read_timeout: Float::INFINITY,
|
||||
write_timeout: Float::INFINITY,
|
||||
request_timeout: Float::INFINITY,
|
||||
},
|
||||
:ssl => { :foo => "bar" },
|
||||
:http2_settings => { :settings_enable_push => 0 },
|
||||
|
@ -74,7 +74,7 @@ class SessionTest < Minitest::Test
|
||||
response = session.get(uri)
|
||||
verify_error_response(response, HTTPX::ReadTimeoutError)
|
||||
|
||||
uri = build_uri("/drip?numbytes=10&duration=2&delay=0&code=200")
|
||||
uri = build_uri("/drip?numbytes=10&duration=1&delay=0&code=200")
|
||||
response1 = session.get(uri)
|
||||
verify_status(response1, 200)
|
||||
end
|
||||
@ -97,7 +97,7 @@ class SessionTest < Minitest::Test
|
||||
response = session.get(uri)
|
||||
verify_error_response(response, HTTPX::RequestTimeoutError)
|
||||
|
||||
uri = build_uri("/drip?numbytes=10&duration=2&delay=0&code=200")
|
||||
uri = build_uri("/drip?numbytes=10&duration=1&delay=0&code=200")
|
||||
response1 = session.get(uri)
|
||||
verify_status(response1, 200)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user