excon 0.16.10 → 0.17.0

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.

@@ -185,7 +185,7 @@ Shindo.tests('Excon instrumentation') do
185
185
  end
186
186
 
187
187
  test('does not mutate Authorization value') do
188
- @connection.connection[:headers]['Authorization'] == @auth_header
188
+ @connection.data[:headers]['Authorization'] == @auth_header
189
189
  end
190
190
 
191
191
  end
@@ -5,24 +5,24 @@ Shindo.tests('Excon proxy support') do
5
5
  tests('no proxy') do
6
6
  connection = Excon.new('http://foo.com')
7
7
 
8
- tests('connection.proxy').returns(nil) do
9
- connection.proxy
8
+ tests('connection.data[:proxy]').returns(nil) do
9
+ connection.data[:proxy]
10
10
  end
11
11
  end
12
12
 
13
13
  tests('with fully-specified proxy: https://myproxy.net:8080') do
14
14
  connection = Excon.new('http://foo.com', :proxy => 'https://myproxy.net:8080')
15
15
 
16
- tests('connection.proxy.host').returns('myproxy.net') do
17
- connection.proxy[:host]
16
+ tests('connection.data[:proxy][:host]').returns('myproxy.net') do
17
+ connection.data[:proxy][:host]
18
18
  end
19
19
 
20
- tests('connection.proxy.port').returns(8080) do
21
- connection.proxy[:port]
20
+ tests('connection.data[:proxy][:port]').returns(8080) do
21
+ connection.data[:proxy][:port]
22
22
  end
23
23
 
24
- tests('connection.proxy.scheme').returns('https') do
25
- connection.proxy[:scheme]
24
+ tests('connection.data[:proxy][:scheme]').returns('https') do
25
+ connection.data[:proxy][:scheme]
26
26
  end
27
27
  end
28
28
 
@@ -33,44 +33,44 @@ Shindo.tests('Excon proxy support') do
33
33
  tests('an http connection') do
34
34
  connection = Excon.new('http://foo.com')
35
35
 
36
- tests('connection.proxy.host').returns('myproxy') do
37
- connection.proxy[:host]
36
+ tests('connection.data[:proxy][:host]').returns('myproxy') do
37
+ connection.data[:proxy][:host]
38
38
  end
39
39
 
40
- tests('connection.proxy.port').returns(8080) do
41
- connection.proxy[:port]
40
+ tests('connection.data[:proxy][:port]').returns(8080) do
41
+ connection.data[:proxy][:port]
42
42
  end
43
43
 
44
- tests('connection.proxy.scheme').returns('http') do
45
- connection.proxy[:scheme]
44
+ tests('connection.data[:proxy][:scheme]').returns('http') do
45
+ connection.data[:proxy][:scheme]
46
46
  end
47
47
  end
48
48
 
49
49
  tests('an https connection') do
50
50
  connection = Excon.new('https://secret.com')
51
51
 
52
- tests('connection.proxy.host').returns('mysecureproxy') do
53
- connection.proxy[:host]
52
+ tests('connection.data[:proxy][:host]').returns('mysecureproxy') do
53
+ connection.data[:proxy][:host]
54
54
  end
55
55
 
56
- tests('connection.proxy.port').returns(8081) do
57
- connection.proxy[:port]
56
+ tests('connection.data[:proxy][:port]').returns(8081) do
57
+ connection.data[:proxy][:port]
58
58
  end
59
59
 
60
- tests('connection.proxy.scheme').returns('http') do
61
- connection.proxy[:scheme]
60
+ tests('connection.data[:proxy][:scheme]').returns('http') do
61
+ connection.data[:proxy][:scheme]
62
62
  end
63
63
  end
64
64
 
65
65
  tests('http proxy from the environment overrides config') do
66
66
  connection = Excon.new('http://foo.com', :proxy => 'http://hard.coded.proxy:6666')
67
67
 
68
- tests('connection.proxy.host').returns('myproxy') do
69
- connection.proxy[:host]
68
+ tests('connection.data[:proxy][:host]').returns('myproxy') do
69
+ connection.data[:proxy][:host]
70
70
  end
71
71
 
72
- tests('connection.proxy.port').returns(8080) do
73
- connection.proxy[:port]
72
+ tests('connection.data[:proxy][:port]').returns(8080) do
73
+ connection.data[:proxy][:port]
74
74
  end
75
75
  end
76
76
 
@@ -85,44 +85,44 @@ Shindo.tests('Excon proxy support') do
85
85
  tests('an http connection') do
86
86
  connection = Excon.new('http://foo.com')
87
87
 
88
- tests('connection.proxy.host').returns('myproxy') do
89
- connection.proxy[:host]
88
+ tests('connection.data[:proxy][:host]').returns('myproxy') do
89
+ connection.data[:proxy][:host]
90
90
  end
91
91
 
92
- tests('connection.proxy.port').returns(8080) do
93
- connection.proxy[:port]
92
+ tests('connection.data[:proxy][:port]').returns(8080) do
93
+ connection.data[:proxy][:port]
94
94
  end
95
95
 
96
- tests('connection.proxy.scheme').returns('http') do
97
- connection.proxy[:scheme]
96
+ tests('connection.data[:proxy][:scheme]').returns('http') do
97
+ connection.data[:proxy][:scheme]
98
98
  end
99
99
  end
100
100
 
101
101
  tests('an https connection') do
102
102
  connection = Excon.new('https://secret.com')
103
103
 
104
- tests('connection.proxy.host').returns('mysecureproxy') do
105
- connection.proxy[:host]
104
+ tests('connection.data[:proxy][:host]').returns('mysecureproxy') do
105
+ connection.data[:proxy][:host]
106
106
  end
107
107
 
108
- tests('connection.proxy.port').returns(8081) do
109
- connection.proxy[:port]
108
+ tests('connection.data[:proxy][:port]').returns(8081) do
109
+ connection.data[:proxy][:port]
110
110
  end
111
111
 
112
- tests('connection.proxy.scheme').returns('http') do
113
- connection.proxy[:scheme]
112
+ tests('connection.data[:proxy][:scheme]').returns('http') do
113
+ connection.data[:proxy][:scheme]
114
114
  end
115
115
  end
116
116
 
117
117
  tests('http proxy from the environment overrides config') do
118
118
  connection = Excon.new('http://foo.com', :proxy => 'http://hard.coded.proxy:6666')
119
119
 
120
- tests('connection.proxy.host').returns('myproxy') do
121
- connection.proxy[:host]
120
+ tests('connection.data[:proxy][:host]').returns('myproxy') do
121
+ connection.data[:proxy][:host]
122
122
  end
123
123
 
124
- tests('connection.proxy.port').returns(8080) do
125
- connection.proxy[:port]
124
+ tests('connection.data[:proxy][:port]').returns(8080) do
125
+ connection.data[:proxy][:port]
126
126
  end
127
127
  end
128
128
 
@@ -137,16 +137,16 @@ Shindo.tests('Excon proxy support') do
137
137
  tests('an https connection') do
138
138
  connection = Excon.new('https://secret.com')
139
139
 
140
- tests('connection.proxy.host').returns('myproxy') do
141
- connection.proxy[:host]
140
+ tests('connection.data[:proxy][:host]').returns('myproxy') do
141
+ connection.data[:proxy][:host]
142
142
  end
143
143
 
144
- tests('connection.proxy.port').returns(8080) do
145
- connection.proxy[:port]
144
+ tests('connection.data[:proxy][:port]').returns(8080) do
145
+ connection.data[:proxy][:port]
146
146
  end
147
147
 
148
- tests('connection.proxy.scheme').returns('http') do
149
- connection.proxy[:scheme]
148
+ tests('connection.data[:proxy][:scheme]').returns('http') do
149
+ connection.data[:proxy][:scheme]
150
150
  end
151
151
  end
152
152
 
@@ -0,0 +1,11 @@
1
+ require 'sinatra'
2
+
3
+ class App < Sinatra::Base
4
+ post '/' do
5
+ h = ""
6
+ env.each { |k,v| h << "#{$1.downcase}: #{v}\n" if k =~ /http_(.*)/i }
7
+ h
8
+ end
9
+ end
10
+
11
+ run App
@@ -0,0 +1,21 @@
1
+ Shindo.tests('Excon request methods') do
2
+
3
+ with_rackup('request_headers.ru') do
4
+
5
+ tests 'empty headers sent' do
6
+
7
+ test('Excon.post') do
8
+ headers = {
9
+ :one => 1,
10
+ :two => nil,
11
+ :three => 3,
12
+ }
13
+ r = Excon.post('http://localhost:9292', :headers => headers).body
14
+ !r.match(/two:/).nil?
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+
21
+ end
@@ -43,6 +43,10 @@ def basic_tests(url = 'http://127.0.0.1:9292')
43
43
  response.headers['Custom']
44
44
  end
45
45
 
46
+ tests("response.remote_ip").returns("127.0.0.1") do
47
+ response.remote_ip
48
+ end
49
+
46
50
  tests("response.body").returns('x' * 100) do
47
51
  response.body
48
52
  end
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.16.10
4
+ version: 0.17.0
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-16 00:00:00.000000000 Z
14
+ date: 2013-02-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -177,6 +177,8 @@ files:
177
177
  - lib/excon/connection.rb
178
178
  - lib/excon/constants.rb
179
179
  - lib/excon/errors.rb
180
+ - lib/excon/middlewares/expects.rb
181
+ - lib/excon/middlewares/instrumentor.rb
180
182
  - lib/excon/response.rb
181
183
  - lib/excon/socket.rb
182
184
  - lib/excon/ssl_socket.rb
@@ -187,7 +189,7 @@ files:
187
189
  - tests/data/xs
188
190
  - tests/header_tests.rb
189
191
  - tests/idempotent_tests.rb
190
- - tests/instrumentation_tests.rb
192
+ - tests/middlewares/instrumentation_tests.rb
191
193
  - tests/proxy_tests.rb
192
194
  - tests/query_string_tests.rb
193
195
  - tests/rackups/basic.rb
@@ -195,11 +197,13 @@ files:
195
197
  - tests/rackups/basic_auth.ru
196
198
  - tests/rackups/proxy.ru
197
199
  - tests/rackups/query_string.ru
200
+ - tests/rackups/request_headers.ru
198
201
  - tests/rackups/request_methods.ru
199
202
  - tests/rackups/response_header.ru
200
203
  - tests/rackups/ssl.ru
201
204
  - tests/rackups/thread_safety.ru
202
205
  - tests/rackups/timeout.ru
206
+ - tests/request_headers_tests.rb
203
207
  - tests/request_method_tests.rb
204
208
  - tests/servers/bad.rb
205
209
  - tests/servers/eof.rb
@@ -222,7 +226,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
222
226
  version: '0'
223
227
  segments:
224
228
  - 0
225
- hash: 4511517215737189818
229
+ hash: 4091555892439791383
226
230
  required_rubygems_version: !ruby/object:Gem::Requirement
227
231
  none: false
228
232
  requirements:
@@ -231,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
235
  version: '0'
232
236
  requirements: []
233
237
  rubyforge_project: excon
234
- rubygems_version: 1.8.23
238
+ rubygems_version: 1.8.24
235
239
  signing_key:
236
240
  specification_version: 2
237
241
  summary: speed, persistence, http(s)