excon 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of excon might be problematic. Click here for more details.
- data/Gemfile +1 -1
- data/changelog.txt +7 -0
- data/excon.gemspec +4 -2
- data/lib/excon.rb +1 -1
- data/lib/excon/connection.rb +10 -2
- data/tests/query_string_tests.rb +60 -0
- data/tests/rackups/query_string.ru +9 -0
- metadata +6 -4
data/Gemfile
CHANGED
data/changelog.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
0.5.8 03/24/11
|
2
|
+
==============
|
3
|
+
|
4
|
+
* fix regression where nil values in queries were ignored in 1.9. thanks mattsa
|
5
|
+
* fix regression causing EOFError when making many connections in one thread
|
6
|
+
* added tests to prevent both of the former from recurring
|
7
|
+
|
1
8
|
0.5.7 03/21/11
|
2
9
|
==============
|
3
10
|
|
data/excon.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'excon'
|
16
|
-
s.version = '0.5.
|
17
|
-
s.date = '2011-03-
|
16
|
+
s.version = '0.5.8'
|
17
|
+
s.date = '2011-03-24'
|
18
18
|
s.rubyforge_project = 'excon'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
@@ -89,7 +89,9 @@ Gem::Specification.new do |s|
|
|
89
89
|
lib/excon/errors.rb
|
90
90
|
lib/excon/response.rb
|
91
91
|
tests/basic_tests.rb
|
92
|
+
tests/query_string_tests.rb
|
92
93
|
tests/rackups/basic.ru
|
94
|
+
tests/rackups/query_string.ru
|
93
95
|
tests/rackups/thread_safety.ru
|
94
96
|
tests/stub_tests.rb
|
95
97
|
tests/test_helper.rb
|
data/lib/excon.rb
CHANGED
data/lib/excon/connection.rb
CHANGED
@@ -28,6 +28,7 @@ module Excon
|
|
28
28
|
}.merge!(params)
|
29
29
|
|
30
30
|
@socket_key = '' << @connection[:host] << ':' << @connection[:port].to_s
|
31
|
+
reset
|
31
32
|
end
|
32
33
|
|
33
34
|
# Sends the supplied request to the destination host.
|
@@ -72,8 +73,15 @@ module Excon
|
|
72
73
|
when Hash
|
73
74
|
request << '?'
|
74
75
|
for key, values in params[:query]
|
75
|
-
|
76
|
-
|
76
|
+
case values
|
77
|
+
when nil
|
78
|
+
request << key.to_s << '&'
|
79
|
+
when Array
|
80
|
+
values.each do |value|
|
81
|
+
request << key.to_s << '=' << CGI.escape(value.to_s) << '&'
|
82
|
+
end
|
83
|
+
else
|
84
|
+
request << key.to_s << '=' << CGI.escape(values.to_s) << '&'
|
77
85
|
end
|
78
86
|
end
|
79
87
|
request.chop! # remove trailing '&'
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
|
+
|
3
|
+
with_rackup('query_string.ru') do
|
4
|
+
Shindo.tests('Excon query string variants') do
|
5
|
+
connection = Excon.new('http://127.0.0.1:9292')
|
6
|
+
|
7
|
+
tests(":query => {:foo => 'bar'}") do
|
8
|
+
|
9
|
+
response = connection.request(:method => :get, :path => '/query', :query => {:foo => 'bar'})
|
10
|
+
query_string = response.body[7..-1] # query string sent
|
11
|
+
|
12
|
+
tests("query string sent").returns('foo=bar') do
|
13
|
+
query_string
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
tests(":query => {:foo => nil}") do
|
19
|
+
|
20
|
+
response = connection.request(:method => :get, :path => '/query', :query => {:foo => nil})
|
21
|
+
query_string = response.body[7..-1] # query string sent
|
22
|
+
|
23
|
+
tests("query string sent").returns('foo') do
|
24
|
+
query_string
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
tests(":query => {:foo => 'bar', :me => nil}") do
|
30
|
+
|
31
|
+
response = connection.request(:method => :get, :path => '/query', :query => {:foo => 'bar', :me => nil})
|
32
|
+
query_string = response.body[7..-1] # query string sent
|
33
|
+
|
34
|
+
tests("query string sent includes 'foo=bar'").returns(true) do
|
35
|
+
query_string.split('&').include?('foo=bar')
|
36
|
+
end
|
37
|
+
|
38
|
+
tests("query string sent includes 'me'").returns(true) do
|
39
|
+
query_string.split('&').include?('me')
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
tests(":query => {:foo => 'bar', :me => 'too'}") do
|
45
|
+
|
46
|
+
response = connection.request(:method => :get, :path => '/query', :query => {:foo => 'bar', :me => 'too'})
|
47
|
+
query_string = response.body[7..-1] # query string sent
|
48
|
+
|
49
|
+
tests("query string sent includes 'foo=bar'").returns(true) do
|
50
|
+
query_string.split('&').include?('foo=bar')
|
51
|
+
end
|
52
|
+
|
53
|
+
tests("query string sent includes 'me=too'").returns(true) do
|
54
|
+
query_string.split('&').include?('me=too')
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 8
|
10
|
+
version: 0.5.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- geemus (Wesley Beary)
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-24 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -111,7 +111,9 @@ files:
|
|
111
111
|
- lib/excon/errors.rb
|
112
112
|
- lib/excon/response.rb
|
113
113
|
- tests/basic_tests.rb
|
114
|
+
- tests/query_string_tests.rb
|
114
115
|
- tests/rackups/basic.ru
|
116
|
+
- tests/rackups/query_string.ru
|
115
117
|
- tests/rackups/thread_safety.ru
|
116
118
|
- tests/stub_tests.rb
|
117
119
|
- tests/test_helper.rb
|