Method: HTTPX::Connection::HTTP1#empty?

Defined in:
lib/httpx/connection/http1.rb

#empty?Boolean

Returns:

  • (Boolean)


64
65
66
67
68
69
70
71
72
73
# File 'lib/httpx/connection/http1.rb', line 64

def empty?
  # this means that for every request there's an available
  # partial response, so there are no in-flight requests waiting.
  @requests.empty? || (
    # checking all responses can be time-consuming. Alas, as in HTTP/1, responses
    # do not come out of order, we can get away with checking first and last.
    !@requests.first.response.nil? &&
    (@requests.size == 1 || !@requests.last.response.nil?)
  )
end