typhoeus 0.5.2 → 0.5.3
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/CHANGELOG.md +14 -1
- data/lib/typhoeus/expectation.rb +7 -2
- data/lib/typhoeus/hydra/runnable.rb +6 -2
- data/lib/typhoeus/response/header.rb +7 -2
- data/lib/typhoeus/version.rb +1 -1
- metadata +3 -3
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,20 @@
|
|
2
2
|
|
3
3
|
## Master
|
4
4
|
|
5
|
-
[Full Changelog](http://github.com/typhoeus/typhoeus/compare/v0.5.
|
5
|
+
[Full Changelog](http://github.com/typhoeus/typhoeus/compare/v0.5.3...master)
|
6
|
+
|
7
|
+
## 0.5.3
|
8
|
+
|
9
|
+
[Full Changelog](http://github.com/typhoeus/typhoeus/compare/v0.5.2...v0.5.3)
|
10
|
+
|
11
|
+
Enhancements:
|
12
|
+
|
13
|
+
* When checking options in Expecation#matches? also consider Request#options.
|
14
|
+
|
15
|
+
Bugfixes:
|
16
|
+
|
17
|
+
* Do not break backwards compatibility with case insensitive headers access.
|
18
|
+
* Make sure hydra behaves correct in case of before hooks.
|
6
19
|
|
7
20
|
## 0.5.2
|
8
21
|
|
data/lib/typhoeus/expectation.rb
CHANGED
@@ -117,8 +117,7 @@ module Typhoeus
|
|
117
117
|
#
|
118
118
|
# @api private
|
119
119
|
def matches?(request)
|
120
|
-
url_match?(request.url) &&
|
121
|
-
(options ? options.all?{ |k,v| request.original_options[k] == v } : true)
|
120
|
+
url_match?(request.url) && options_match?(request)
|
122
121
|
end
|
123
122
|
|
124
123
|
# Return canned responses.
|
@@ -152,6 +151,12 @@ module Typhoeus
|
|
152
151
|
|
153
152
|
private
|
154
153
|
|
154
|
+
# Check wether the options matches the request options.
|
155
|
+
# I checks options and original options.
|
156
|
+
def options_match?(request)
|
157
|
+
(options ? options.all?{ |k,v| request.original_options[k] == v || request.options[k] == v } : true)
|
158
|
+
end
|
159
|
+
|
155
160
|
# Check wether the url matches the request url.
|
156
161
|
# The url can be a string, regex or nil. String and
|
157
162
|
# regexp were checked, nil is always true. Else false.
|
@@ -11,8 +11,12 @@ module Typhoeus
|
|
11
11
|
#
|
12
12
|
# @return [ Symbol ] Return value from multi.perform.
|
13
13
|
def run
|
14
|
-
|
15
|
-
|
14
|
+
number_requests = 0
|
15
|
+
loop do
|
16
|
+
break if number_requests == max_concurrency || queued_requests.empty?
|
17
|
+
number_requests += queued_requests.pop(max_concurrency).map do |request|
|
18
|
+
add(request)
|
19
|
+
end.size
|
16
20
|
end
|
17
21
|
multi.perform
|
18
22
|
end
|
@@ -28,6 +28,12 @@ module Typhoeus
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
def [](key)
|
32
|
+
self.each do |k, v|
|
33
|
+
return v if k.downcase == key.downcase
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
31
37
|
private
|
32
38
|
|
33
39
|
# Processes line and saves the result.
|
@@ -35,10 +41,9 @@ module Typhoeus
|
|
35
41
|
# @return [ void ]
|
36
42
|
def process_line(header)
|
37
43
|
key, value = header.split(':', 2).map(&:strip)
|
38
|
-
key = key.downcase
|
39
44
|
if self.has_key?(key)
|
40
45
|
self[key] = [self[key]] unless self[key].is_a? Array
|
41
|
-
self[key]
|
46
|
+
self[key].push(value)
|
42
47
|
else
|
43
48
|
self[key] = value
|
44
49
|
end
|
data/lib/typhoeus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typhoeus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-11-
|
14
|
+
date: 2012-11-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: ethon
|
@@ -88,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
segments:
|
90
90
|
- 0
|
91
|
-
hash:
|
91
|
+
hash: 419611758295813081
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
93
|
none: false
|
94
94
|
requirements:
|