Module: HTTPX::Plugins::Stream::InstanceMethods

Defined in:
lib/httpx/plugins/stream.rb

Instance Method Summary collapse

Instance Method Details

#request(*args, stream: false, **options) ⇒ Object

Raises:



103
104
105
106
107
108
109
110
111
112
# File 'lib/httpx/plugins/stream.rb', line 103

def request(*args, stream: false, **options)
  return super(*args, **options) unless stream

  requests = args.first.is_a?(Request) ? args : build_requests(*args, options)
  raise Error, "only 1 response at a time is supported for streaming requests" unless requests.size == 1

  request = requests.first

  StreamResponse.new(request, self)
end