mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-04 00:00:37 -04:00
adding Request#can_buffer?
abstracts some logic around whether a request has request body bytes to buffer
This commit is contained in:
parent
870b8aed69
commit
c48f6c8e8f
@ -93,7 +93,7 @@ module HTTPX
|
||||
concurrent_requests_limit = [@max_concurrent_requests, requests_limit].min
|
||||
@requests.each_with_index do |request, idx|
|
||||
break if idx >= concurrent_requests_limit
|
||||
next if request.state == :done
|
||||
next unless request.can_buffer?
|
||||
|
||||
handle(request)
|
||||
end
|
||||
|
@ -124,7 +124,7 @@ module HTTPX
|
||||
|
||||
def consume
|
||||
@streams.each do |request, stream|
|
||||
next if request.state == :done
|
||||
next unless request.can_buffer?
|
||||
|
||||
handle(request, stream)
|
||||
end
|
||||
|
@ -155,6 +155,10 @@ module HTTPX
|
||||
:w
|
||||
end
|
||||
|
||||
def can_buffer?
|
||||
@state != :done
|
||||
end
|
||||
|
||||
# merges +h+ into the instance of HTTPX::Headers of the request.
|
||||
def merge_headers(h)
|
||||
@headers = @headers.merge(h)
|
||||
|
@ -39,6 +39,8 @@ module HTTPX
|
||||
|
||||
def interests: () -> (:r | :w)
|
||||
|
||||
def can_buffer? : () -> bool
|
||||
|
||||
def merge_headers: (_Each[[String, headers_value]]) -> void
|
||||
|
||||
def scheme: () -> String
|
||||
|
Loading…
x
Reference in New Issue
Block a user