Module: HTTPX::Plugins::StreamBidi::RequestBodyMethods

Defined in:
lib/httpx/plugins/stream_bidi.rb,
sig/plugins/stream_bidi.rbs

Instance Method Summary collapse

Instance Method Details

#empty? ⇒ Boolean

Returns:

  • (Boolean)


365
366
367
368
369
# File 'lib/httpx/plugins/stream_bidi.rb', line 365

def empty?
  return super unless @options.stream

  false
end

#initialize ⇒ Object

Raises:



350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/httpx/plugins/stream_bidi.rb', line 350

def initialize(*, **)
  super

  return unless @options.stream

  @headers.delete("content-length")

  return unless @body

  return if @body.is_a?(Transcoder::Body::Encoder)

  raise Error, "bidirectional streams only allow the usage of the `:body` param to set request bodies." \
               "You must encode it yourself if you wish to do so."
end