typhoeus 0.1.20 → 0.1.21
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/typhoeus.rb +1 -1
- data/lib/typhoeus/easy.rb +4 -1
- data/lib/typhoeus/request.rb +4 -0
- data/spec/servers/app.rb +4 -0
- data/spec/typhoeus/easy_spec.rb +10 -0
- metadata +1 -1
data/lib/typhoeus.rb
CHANGED
data/lib/typhoeus/easy.rb
CHANGED
@@ -22,7 +22,8 @@ module Typhoeus
|
|
22
22
|
:CURLOPT_USERPWD => 10000 + 5,
|
23
23
|
:CURLOPT_VERBOSE => 41,
|
24
24
|
:CURLOPT_PROXY => 10004,
|
25
|
-
:CURLOPT_VERIFYPEER => 64
|
25
|
+
:CURLOPT_VERIFYPEER => 64,
|
26
|
+
:CURLOPT_NOBODY => 44
|
26
27
|
}
|
27
28
|
INFO_VALUES = {
|
28
29
|
:CURLINFO_RESPONSE_CODE => 2097154,
|
@@ -128,6 +129,8 @@ module Typhoeus
|
|
128
129
|
elsif method == :put
|
129
130
|
set_option(OPTION_VALUES[:CURLOPT_UPLOAD], 1)
|
130
131
|
self.request_body = "" unless @request_body
|
132
|
+
elsif method == :head
|
133
|
+
set_option(OPTION_VALUES[:CURLOPT_NOBODY], 1)
|
131
134
|
else
|
132
135
|
set_option(OPTION_VALUES[:CURLOPT_CUSTOMREQUEST], "DELETE")
|
133
136
|
end
|
data/lib/typhoeus/request.rb
CHANGED
data/spec/servers/app.rb
CHANGED
@@ -53,6 +53,10 @@ get '/**' do
|
|
53
53
|
request.env.merge!(:body => request.body.read).to_json
|
54
54
|
end
|
55
55
|
|
56
|
+
head '/**' do
|
57
|
+
sleep params["delay"].to_i if params.has_key?("delay")
|
58
|
+
end
|
59
|
+
|
56
60
|
put '/**' do
|
57
61
|
puts request.inspect
|
58
62
|
request.env.merge!(:body => request.body.read).to_json
|
data/spec/typhoeus/easy_spec.rb
CHANGED
@@ -101,6 +101,16 @@ describe Typhoeus::Easy do
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
describe "head" do
|
105
|
+
it "should perform a head" do
|
106
|
+
easy = Typhoeus::Easy.new
|
107
|
+
easy.url = "http://localhost:3002"
|
108
|
+
easy.method = :head
|
109
|
+
easy.perform
|
110
|
+
easy.response_code.should == 200
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
104
114
|
describe "start_time" do
|
105
115
|
it "should be get/settable" do
|
106
116
|
time = Time.now
|