em-http-test 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/em-http-test/test-request.rb +10 -6
- data/lib/em-http-test/version.rb +1 -1
- metadata +1 -1
@@ -8,6 +8,14 @@ module EventMachine::HttpTest
|
|
8
8
|
|
9
9
|
# Base test request object that contains the test data
|
10
10
|
class Request
|
11
|
+
@@reqOptions = {
|
12
|
+
:connect_timeout => 5, # default connection setup timeout
|
13
|
+
:inactivity_timeout => 30, # default connection inactivity (post-setup) timeout
|
14
|
+
}
|
15
|
+
|
16
|
+
def self.option(opts = {})
|
17
|
+
opts.each { |k,v| self.reqOptions[k] =v }
|
18
|
+
end
|
11
19
|
|
12
20
|
def initialize(type, url, options = {})
|
13
21
|
@type = type
|
@@ -20,15 +28,11 @@ module EventMachine::HttpTest
|
|
20
28
|
end
|
21
29
|
|
22
30
|
def toRequest
|
23
|
-
opts = {
|
24
|
-
:connect_timeout => 5, # default connection setup timeout
|
25
|
-
:inactivity_timeout => 30, # default connection inactivity (post-setup) timeout
|
26
|
-
}
|
27
31
|
case @type
|
28
32
|
when :GET
|
29
|
-
EM::HttpRequest.new(@url,
|
33
|
+
EM::HttpRequest.new(@url, @@reqOptions).get @options
|
30
34
|
when :POST
|
31
|
-
EM::HttpRequest.new(@url,
|
35
|
+
EM::HttpRequest.new(@url, @@reqOptions).post @options
|
32
36
|
end
|
33
37
|
end
|
34
38
|
end
|
data/lib/em-http-test/version.rb
CHANGED