lib/httpi/response.rb in httpi-0.7.7 vs lib/httpi/response.rb in httpi-0.7.8
- old
+ new
@@ -25,10 +25,16 @@
# Returns whether the HTTP response is considered successful.
def error?
!SuccessfulResponseCodes.include? code.to_i
end
+ # Returns whether the HTTP response is a multipart response.
+ def multipart?
+ !!(headers["Content-Type"] =~ /^multipart/i)
+ end
+
+ # Returns any DIME attachments.
def attachments
decode_body unless @body
@attachments ||= []
end
@@ -46,10 +52,9 @@
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