httpi 0.7.7 → 0.7.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,6 +27,12 @@ module HTTPI
27
27
  !SuccessfulResponseCodes.include? code.to_i
28
28
  end
29
29
 
30
+ # Returns whether the HTTP response is a multipart response.
31
+ def multipart?
32
+ !!(headers["Content-Type"] =~ /^multipart/i)
33
+ end
34
+
35
+ # Returns any DIME attachments.
30
36
  def attachments
31
37
  decode_body unless @body
32
38
  @attachments ||= []
@@ -49,7 +55,6 @@ module HTTPI
49
55
  @body = dime_response? ? decoded_dime_body(body) : body
50
56
  end
51
57
 
52
-
53
58
  # Returns whether the response is gzipped.
54
59
  def gzipped_response?
55
60
  headers["Content-Encoding"] == "gzip" || raw_body[0..1] == "\x1f\x8b"
data/lib/httpi/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module HTTPI
2
2
 
3
- VERSION = "0.7.7"
3
+ VERSION = "0.7.8"
4
4
 
5
5
  end
@@ -28,6 +28,12 @@ describe HTTPI::Response do
28
28
  response.code.should == 200
29
29
  end
30
30
  end
31
+
32
+ describe "#multipart" do
33
+ it "should return false" do
34
+ response.should_not be_multipart
35
+ end
36
+ end
31
37
  end
32
38
 
33
39
  context "empty" do
@@ -40,6 +46,16 @@ describe HTTPI::Response do
40
46
  end
41
47
  end
42
48
 
49
+ context "multipart" do
50
+ let(:response) { HTTPI::Response.new 200, { "Content-Type" => "multipart/related" }, "multipart" }
51
+
52
+ describe "#multipart" do
53
+ it "should return true" do
54
+ response.should be_multipart
55
+ end
56
+ end
57
+ end
58
+
43
59
  context "error" do
44
60
  let(:response) { HTTPI::Response.new 404, {}, "" }
45
61
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 7
10
- version: 0.7.7
9
+ - 8
10
+ version: 0.7.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Harrington
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-01-05 00:00:00 +01:00
19
+ date: 2011-01-08 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency