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

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

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


353
354
355
356
357
# File 'lib/httpx/plugins/stream_bidi.rb', line 353

def empty?
  return super unless @options.stream

  false
end

#initializeObject

Raises:



338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/httpx/plugins/stream_bidi.rb', line 338

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