excon 0.14.1 → 0.14.2
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/changelog.txt +6 -1
- data/excon.gemspec +2 -2
- data/lib/excon/connection.rb +15 -1
- data/lib/excon/constants.rb +1 -1
- data/tests/stub_tests.rb +20 -0
- metadata +17 -17
data/changelog.txt
CHANGED
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.14.
|
17
|
-
s.date = '2012-06-
|
16
|
+
s.version = '0.14.2'
|
17
|
+
s.date = '2012-06-26'
|
18
18
|
s.rubyforge_project = 'excon'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
data/lib/excon/connection.rb
CHANGED
@@ -242,7 +242,9 @@ module Excon
|
|
242
242
|
socket.write(params[:body])
|
243
243
|
end
|
244
244
|
else
|
245
|
-
|
245
|
+
if params[:body].respond_to?(:binmode)
|
246
|
+
params[:body].binmode
|
247
|
+
end
|
246
248
|
while chunk = params[:body].read(CHUNK_SIZE)
|
247
249
|
socket.write(chunk)
|
248
250
|
end
|
@@ -274,6 +276,18 @@ module Excon
|
|
274
276
|
end
|
275
277
|
|
276
278
|
def invoke_stub(params)
|
279
|
+
|
280
|
+
# convert File/Tempfile body to string before matching:
|
281
|
+
unless params[:body].nil? || params[:body].is_a?(String)
|
282
|
+
if params[:body].respond_to?(:binmode)
|
283
|
+
params[:body].binmode
|
284
|
+
end
|
285
|
+
if params[:body].respond_to?(:rewind)
|
286
|
+
params[:body].rewind
|
287
|
+
end
|
288
|
+
params[:body] = params[:body].read
|
289
|
+
end
|
290
|
+
|
277
291
|
params[:captures] = {:headers => {}} # setup data to hold captures
|
278
292
|
for stub, response in Excon.stubs
|
279
293
|
headers_match = !stub.has_key?(:headers) || stub[:headers].keys.all? do |key|
|
data/lib/excon/constants.rb
CHANGED
data/tests/stub_tests.rb
CHANGED
@@ -105,6 +105,26 @@ Shindo.tests('Excon stubs') do
|
|
105
105
|
|
106
106
|
end
|
107
107
|
|
108
|
+
tests("stub({:body => File.open(...), :method => :get}, { :status => 200 })") do
|
109
|
+
|
110
|
+
file_path = File.join(File.dirname(__FILE__), 'data', 'xs')
|
111
|
+
|
112
|
+
Excon.stub(
|
113
|
+
{ :body => File.read(file_path), :method => :get },
|
114
|
+
{ :status => 200 }
|
115
|
+
)
|
116
|
+
|
117
|
+
connection = Excon.new('http://127.0.0.1:9292', :mock => true)
|
118
|
+
response = connection.request(:body => File.open(file_path), :method => :get, :path => '/')
|
119
|
+
|
120
|
+
tests('response.status') do
|
121
|
+
response.status
|
122
|
+
end
|
123
|
+
|
124
|
+
Excon.stubs.clear
|
125
|
+
|
126
|
+
end
|
127
|
+
|
108
128
|
tests("mismatched stub").raises(Excon::Errors::StubNotFound) do
|
109
129
|
Excon.stub({:method => :post}, {:body => 'body'})
|
110
130
|
Excon.get('http://127.0.0.1:9292/', :mock => true)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-06-
|
14
|
+
date: 2012-06-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
18
|
-
requirement: &
|
18
|
+
requirement: &70178391272380 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: '0'
|
24
24
|
type: :development
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70178391272380
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: delorean
|
29
|
-
requirement: &
|
29
|
+
requirement: &70178391271720 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70178391271720
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: open4
|
40
|
-
requirement: &
|
40
|
+
requirement: &70178391271100 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: '0'
|
46
46
|
type: :development
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70178391271100
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rake
|
51
|
-
requirement: &
|
51
|
+
requirement: &70178391270640 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ! '>='
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: '0'
|
57
57
|
type: :development
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *70178391270640
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: rdoc
|
62
|
-
requirement: &
|
62
|
+
requirement: &70178391270200 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ! '>='
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: '0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *70178391270200
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: shindo
|
73
|
-
requirement: &
|
73
|
+
requirement: &70178391269500 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ! '>='
|
@@ -78,10 +78,10 @@ dependencies:
|
|
78
78
|
version: '0'
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *70178391269500
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: sinatra
|
84
|
-
requirement: &
|
84
|
+
requirement: &70178391268720 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ! '>='
|
@@ -89,7 +89,7 @@ dependencies:
|
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
|
-
version_requirements: *
|
92
|
+
version_requirements: *70178391268720
|
93
93
|
description: EXtended http(s) CONnections
|
94
94
|
email: geemus@gmail.com
|
95
95
|
executables: []
|
@@ -168,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
segments:
|
170
170
|
- 0
|
171
|
-
hash:
|
171
|
+
hash: 1386473486061410305
|
172
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
173
|
none: false
|
174
174
|
requirements:
|