iconoclasm 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/iconoclasm/headers.rb +3 -3
- data/spec/iconoclasm/headers_spec.rb +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.4
|
data/lib/iconoclasm/headers.rb
CHANGED
@@ -7,7 +7,7 @@ module Iconoclasm
|
|
7
7
|
def initialize(string)
|
8
8
|
header_string = string.dup
|
9
9
|
http_response = header_string.slice!(REGEXP)
|
10
|
-
@version, @code, @message = parse_http_response(http_response
|
10
|
+
@version, @code, @message = parse_http_response(http_response)
|
11
11
|
@header_hash = parse_header_string(header_string.strip)
|
12
12
|
end
|
13
13
|
|
@@ -50,10 +50,10 @@ module Iconoclasm
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def parse_http_response(response)
|
53
|
-
if response.match(REGEXP || "")
|
53
|
+
if response && response.match(REGEXP || "")
|
54
54
|
[ $1.to_f, $2.to_i, $3.chomp.strip ]
|
55
55
|
else
|
56
|
-
|
56
|
+
[ nil, nil, nil ]
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -15,7 +15,7 @@ describe Iconoclasm::Headers do
|
|
15
15
|
describe "parsing the HTTP response" do
|
16
16
|
|
17
17
|
it "should extract the HTTP version from the headers" do
|
18
|
-
@headers.version.should ==
|
18
|
+
@headers.version.should == 1.1
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should extract the HTTP response code from the headers" do
|