class HTTP::Response::Body
def to_s
-
(String)
- eagerly consume the entire body as a string
def to_s return @contents if @contents fail StateError, "body is being streamed" unless @streaming.nil? begin @streaming = false @contents = "".force_encoding(Encoding::UTF_8) while (chunk = @client.readpartial) @contents << chunk.force_encoding(Encoding::ASCII_8BIT) end rescue @contents = nil raise end @contents end