class HTTP::Request::Body

def size

Returns:
  • (Integer) -
def size
  if @source.is_a?(String)
    @source.bytesize
  elsif @source.respond_to?(:read)
    raise RequestError, "IO object must respond to #size" unless @source.respond_to?(:size)
    @source.size
  elsif @source.nil?
    0
  else
    raise RequestError, "cannot determine size of body: #{@source.inspect}"
  end
end