lib/httpi/response.rb in httpi-0.7.6 vs lib/httpi/response.rb in httpi-0.7.7

- old
+ new

@@ -41,21 +41,24 @@ attr_writer :body private def decode_body + return @body = "" if !raw_body || raw_body.empty? + body = gzipped_response? ? decoded_gzip_body : raw_body @body = dime_response? ? decoded_dime_body(body) : body end + # Returns whether the response is gzipped. def gzipped_response? headers["Content-Encoding"] == "gzip" || raw_body[0..1] == "\x1f\x8b" end # Returns whether this is a DIME response. def dime_response? - headers['Content-Type'] == 'application/dime' + headers["Content-Type"] == "application/dime" end # Returns the gzip decoded response body. def decoded_gzip_body gzip = Zlib::GzipReader.new StringIO.new(raw_body)