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

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

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


343
344
345
346
347
# File 'lib/httpx/plugins/stream_bidi.rb', line 343

def empty?
  return super unless @options.stream

  false
end

#initializeObject

Raises:



328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/httpx/plugins/stream_bidi.rb', line 328

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