excon 0.64.0 → 0.65.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.
- checksums.yaml +4 -4
- data/data/cacert.pem +108 -2
- data/excon.gemspec +7 -2
- data/lib/excon.rb +11 -11
- data/lib/excon/connection.rb +25 -25
- data/lib/excon/response.rb +1 -1
- data/lib/excon/version.rb +1 -1
- metadata +3 -101
- data/.document +0 -5
- data/.github/stale.yml +0 -17
- data/.gitignore +0 -13
- data/.rspec +0 -3
- data/.travis.yml +0 -17
- data/Gemfile +0 -19
- data/Rakefile +0 -41
- data/benchmarks/class_vs_lambda.rb +0 -50
- data/benchmarks/concat_vs_insert.rb +0 -21
- data/benchmarks/concat_vs_interpolate.rb +0 -22
- data/benchmarks/cr_lf.rb +0 -21
- data/benchmarks/downcase-eq-eq_vs_casecmp.rb +0 -169
- data/benchmarks/excon.rb +0 -69
- data/benchmarks/excon_vs.rb +0 -165
- data/benchmarks/for_vs_array_each.rb +0 -27
- data/benchmarks/for_vs_hash_each.rb +0 -27
- data/benchmarks/has_key-vs-lookup.rb +0 -177
- data/benchmarks/headers_case_sensitivity.rb +0 -83
- data/benchmarks/headers_split_vs_match.rb +0 -34
- data/benchmarks/implicit_block-vs-explicit_block.rb +0 -98
- data/benchmarks/merging.rb +0 -21
- data/benchmarks/single_vs_double_quotes.rb +0 -21
- data/benchmarks/string_ranged_index.rb +0 -87
- data/benchmarks/strip_newline.rb +0 -115
- data/benchmarks/vs_stdlib.rb +0 -82
- data/changelog.txt +0 -1113
- data/spec/excon/error_spec.rb +0 -139
- data/spec/excon/test/server_spec.rb +0 -28
- data/spec/excon_spec.rb +0 -7
- data/spec/helpers/file_path_helpers.rb +0 -22
- data/spec/helpers/warning_helpers.rb +0 -9
- data/spec/requests/basic_spec.rb +0 -40
- data/spec/requests/eof_requests_spec.rb +0 -36
- data/spec/requests/unix_socket_spec.rb +0 -38
- data/spec/requests/validation_spec.rb +0 -80
- data/spec/spec_helper.rb +0 -26
- data/spec/support/shared_contexts/test_server_context.rb +0 -83
- data/spec/support/shared_contexts/test_stub_context.rb +0 -11
- data/spec/support/shared_examples/shared_example_for_clients.rb +0 -220
- data/spec/support/shared_examples/shared_example_for_streaming_clients.rb +0 -20
- data/spec/support/shared_examples/shared_example_for_test_servers.rb +0 -16
- data/tests/authorization_header_tests.rb +0 -27
- data/tests/bad_tests.rb +0 -69
- data/tests/basic_tests.rb +0 -351
- data/tests/batch_requests.rb +0 -133
- data/tests/complete_responses.rb +0 -31
- data/tests/data/127.0.0.1.cert.crt +0 -17
- data/tests/data/127.0.0.1.cert.key +0 -28
- data/tests/data/excon.cert.crt +0 -17
- data/tests/data/excon.cert.key +0 -28
- data/tests/data/xs +0 -1
- data/tests/error_tests.rb +0 -145
- data/tests/header_tests.rb +0 -119
- data/tests/instrumentors/logging_instrumentor_tests.rb +0 -28
- data/tests/middleware_tests.rb +0 -27
- data/tests/middlewares/canned_response_tests.rb +0 -34
- data/tests/middlewares/capture_cookies_tests.rb +0 -34
- data/tests/middlewares/decompress_tests.rb +0 -157
- data/tests/middlewares/escape_path_tests.rb +0 -36
- data/tests/middlewares/idempotent_tests.rb +0 -245
- data/tests/middlewares/instrumentation_tests.rb +0 -315
- data/tests/middlewares/mock_tests.rb +0 -304
- data/tests/middlewares/redirect_follower_tests.rb +0 -112
- data/tests/pipeline_tests.rb +0 -40
- data/tests/proxy_tests.rb +0 -306
- data/tests/query_string_tests.rb +0 -87
- data/tests/rackups/basic.rb +0 -41
- data/tests/rackups/basic.ru +0 -3
- data/tests/rackups/basic_auth.ru +0 -14
- data/tests/rackups/deflater.ru +0 -4
- data/tests/rackups/proxy.ru +0 -18
- data/tests/rackups/query_string.ru +0 -13
- data/tests/rackups/redirecting.ru +0 -23
- data/tests/rackups/redirecting_with_cookie.ru +0 -40
- data/tests/rackups/request_headers.ru +0 -15
- data/tests/rackups/request_methods.ru +0 -21
- data/tests/rackups/response_header.ru +0 -18
- data/tests/rackups/ssl.ru +0 -16
- data/tests/rackups/ssl_mismatched_cn.ru +0 -15
- data/tests/rackups/ssl_verify_peer.ru +0 -16
- data/tests/rackups/streaming.ru +0 -30
- data/tests/rackups/thread_safety.ru +0 -17
- data/tests/rackups/timeout.ru +0 -14
- data/tests/rackups/webrick_patch.rb +0 -34
- data/tests/request_headers_tests.rb +0 -21
- data/tests/request_method_tests.rb +0 -47
- data/tests/request_tests.rb +0 -58
- data/tests/response_tests.rb +0 -197
- data/tests/servers/bad.rb +0 -25
- data/tests/servers/eof.rb +0 -17
- data/tests/servers/error.rb +0 -20
- data/tests/servers/good.rb +0 -342
- data/tests/servers/good_ipv4.rb +0 -8
- data/tests/servers/good_ipv6.rb +0 -8
- data/tests/test_helper.rb +0 -297
- data/tests/thread_safety_tests.rb +0 -39
- data/tests/timeout_tests.rb +0 -12
- data/tests/utils_tests.rb +0 -81
data/tests/servers/good_ipv4.rb
DELETED
data/tests/servers/good_ipv6.rb
DELETED
data/tests/test_helper.rb
DELETED
@@ -1,297 +0,0 @@
|
|
1
|
-
require 'rubygems' if RUBY_VERSION < '1.9'
|
2
|
-
require 'bundler/setup'
|
3
|
-
require 'excon'
|
4
|
-
require 'delorean'
|
5
|
-
require 'open4'
|
6
|
-
|
7
|
-
require './spec/helpers/warning_helpers.rb'
|
8
|
-
|
9
|
-
Excon.defaults.merge!(
|
10
|
-
:connect_timeout => 5,
|
11
|
-
:read_timeout => 5,
|
12
|
-
:write_timeout => 5
|
13
|
-
)
|
14
|
-
Excon.set_raise_on_warnings!(true)
|
15
|
-
|
16
|
-
def basic_tests(url = 'http://127.0.0.1:9292', options = {})
|
17
|
-
([true, false] * 2).combination(2).to_a.uniq.each do |nonblock, persistent|
|
18
|
-
connection = nil
|
19
|
-
test do
|
20
|
-
options = options.merge({:ssl_verify_peer => false, :nonblock => nonblock, :persistent => persistent })
|
21
|
-
connection = Excon.new(url, options)
|
22
|
-
true
|
23
|
-
end
|
24
|
-
|
25
|
-
tests("nonblock => #{nonblock}, persistent => #{persistent}") do
|
26
|
-
|
27
|
-
tests('GET /content-length/100') do
|
28
|
-
response = nil
|
29
|
-
|
30
|
-
tests('response.status').returns(200) do
|
31
|
-
response = connection.request(:method => :get, :path => '/content-length/100')
|
32
|
-
|
33
|
-
response.status
|
34
|
-
end
|
35
|
-
|
36
|
-
tests('response[:status]').returns(200) do
|
37
|
-
response[:status]
|
38
|
-
end
|
39
|
-
|
40
|
-
tests("response.headers['Content-Length']").returns('100') do
|
41
|
-
response.headers['Content-Length']
|
42
|
-
end
|
43
|
-
|
44
|
-
tests("response.headers['Content-Type']").returns('text/html;charset=utf-8') do
|
45
|
-
response.headers['Content-Type']
|
46
|
-
end
|
47
|
-
|
48
|
-
test("Time.parse(response.headers['Date']).is_a?(Time)") do
|
49
|
-
pending if connection.data[:scheme] == Excon::UNIX
|
50
|
-
Time.parse(response.headers['Date']).is_a?(Time)
|
51
|
-
end
|
52
|
-
|
53
|
-
test("!!(response.headers['Server'] =~ /^WEBrick/)") do
|
54
|
-
pending if connection.data[:scheme] == Excon::UNIX
|
55
|
-
!!(response.headers['Server'] =~ /^WEBrick/)
|
56
|
-
end
|
57
|
-
|
58
|
-
tests("response.headers['Custom']").returns("Foo: bar") do
|
59
|
-
response.headers['Custom']
|
60
|
-
end
|
61
|
-
|
62
|
-
tests("response.remote_ip").returns("127.0.0.1") do
|
63
|
-
pending if connection.data[:scheme] == Excon::UNIX
|
64
|
-
response.remote_ip
|
65
|
-
end
|
66
|
-
|
67
|
-
tests("response.body").returns('x' * 100) do
|
68
|
-
response.body
|
69
|
-
end
|
70
|
-
|
71
|
-
tests("deprecated block usage").returns(['x' * 100, 0, 100]) do
|
72
|
-
data = []
|
73
|
-
silence_warnings do
|
74
|
-
connection.request(:method => :get, :path => '/content-length/100') do |chunk, remaining_length, total_length|
|
75
|
-
data = [chunk, remaining_length, total_length]
|
76
|
-
end
|
77
|
-
end
|
78
|
-
data
|
79
|
-
end
|
80
|
-
|
81
|
-
tests("response_block usage").returns(['x' * 100, 0, 100]) do
|
82
|
-
data = []
|
83
|
-
response_block = lambda do |chunk, remaining_length, total_length|
|
84
|
-
data = [chunk, remaining_length, total_length]
|
85
|
-
end
|
86
|
-
connection.request(:method => :get, :path => '/content-length/100', :response_block => response_block)
|
87
|
-
data
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
91
|
-
|
92
|
-
tests('POST /body-sink') do
|
93
|
-
|
94
|
-
tests('response.body').returns("5000000") do
|
95
|
-
response = connection.request(:method => :post, :path => '/body-sink', :headers => { 'Content-Type' => 'text/plain' }, :body => 'x' * 5_000_000)
|
96
|
-
response.body
|
97
|
-
end
|
98
|
-
|
99
|
-
tests('empty body').returns('0') do
|
100
|
-
response = connection.request(:method => :post, :path => '/body-sink', :headers => { 'Content-Type' => 'text/plain' }, :body => '')
|
101
|
-
response.body
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
105
|
-
|
106
|
-
tests('POST /echo') do
|
107
|
-
|
108
|
-
tests('with file').returns('x' * 100 + "\n") do
|
109
|
-
file_path = File.join(File.dirname(__FILE__), "data", "xs")
|
110
|
-
response = connection.request(:method => :post, :path => '/echo', :body => File.open(file_path))
|
111
|
-
response.body
|
112
|
-
end
|
113
|
-
|
114
|
-
tests('without request_block').returns('x' * 100) do
|
115
|
-
response = connection.request(:method => :post, :path => '/echo', :body => 'x' * 100)
|
116
|
-
response.body
|
117
|
-
end
|
118
|
-
|
119
|
-
tests('with request_block').returns('x' * 100) do
|
120
|
-
data = ['x'] * 100
|
121
|
-
request_block = lambda do
|
122
|
-
data.shift.to_s
|
123
|
-
end
|
124
|
-
response = connection.request(:method => :post, :path => '/echo', :request_block => request_block)
|
125
|
-
response.body
|
126
|
-
end
|
127
|
-
|
128
|
-
tests('with multi-byte strings') do
|
129
|
-
body = "\xC3\xBC" * 100
|
130
|
-
headers = { 'Custom' => body.dup }
|
131
|
-
if RUBY_VERSION >= '1.9'
|
132
|
-
body.force_encoding('BINARY')
|
133
|
-
headers['Custom'].force_encoding('UTF-8')
|
134
|
-
end
|
135
|
-
|
136
|
-
returns(body, 'properly concatenates request+headers and body') do
|
137
|
-
response = connection.request(:method => :post, :path => '/echo', :headers => headers, :body => body)
|
138
|
-
response.body
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
end
|
143
|
-
|
144
|
-
tests('PUT /echo') do
|
145
|
-
|
146
|
-
tests('with file').returns('x' * 100 + "\n") do
|
147
|
-
file_path = File.join(File.dirname(__FILE__), "data", "xs")
|
148
|
-
response = connection.request(:method => :put, :path => '/echo', :body => File.open(file_path))
|
149
|
-
response.body
|
150
|
-
end
|
151
|
-
|
152
|
-
tests('without request_block').returns('x' * 100) do
|
153
|
-
response = connection.request(:method => :put, :path => '/echo', :body => 'x' * 100)
|
154
|
-
response.body
|
155
|
-
end
|
156
|
-
|
157
|
-
tests('request_block usage').returns('x' * 100) do
|
158
|
-
data = ['x'] * 100
|
159
|
-
request_block = lambda do
|
160
|
-
data.shift.to_s
|
161
|
-
end
|
162
|
-
response = connection.request(:method => :put, :path => '/echo', :request_block => request_block)
|
163
|
-
response.body
|
164
|
-
end
|
165
|
-
|
166
|
-
tests('with multi-byte strings') do
|
167
|
-
body = "\xC3\xBC" * 100
|
168
|
-
headers = { 'Custom' => body.dup }
|
169
|
-
if RUBY_VERSION >= '1.9'
|
170
|
-
body.force_encoding('BINARY')
|
171
|
-
headers['Custom'].force_encoding('UTF-8')
|
172
|
-
end
|
173
|
-
|
174
|
-
returns(body, 'properly concatenates request+headers and body') do
|
175
|
-
response = connection.request(:method => :put, :path => '/echo', :headers => headers, :body => body)
|
176
|
-
response.body
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
end
|
181
|
-
|
182
|
-
tests('should succeed with tcp_nodelay').returns(200) do
|
183
|
-
options = options.merge(:ssl_verify_peer => false, :nonblock => nonblock, :tcp_nodelay => true)
|
184
|
-
connection = Excon.new(url, options)
|
185
|
-
response = connection.request(:method => :get, :path => '/content-length/100')
|
186
|
-
response.status
|
187
|
-
end
|
188
|
-
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
|
194
|
-
PROXY_ENV_VARIABLES = %w{http_proxy https_proxy no_proxy} # All lower-case
|
195
|
-
|
196
|
-
def env_init(env={})
|
197
|
-
current = {}
|
198
|
-
PROXY_ENV_VARIABLES.each do |key|
|
199
|
-
current[key] = ENV.delete(key)
|
200
|
-
current[key.upcase] = ENV.delete(key.upcase)
|
201
|
-
end
|
202
|
-
env_stack << current
|
203
|
-
|
204
|
-
env.each do |key, value|
|
205
|
-
ENV[key] = value
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
def env_restore
|
210
|
-
ENV.update(env_stack.pop)
|
211
|
-
end
|
212
|
-
|
213
|
-
def env_stack
|
214
|
-
@env_stack ||= []
|
215
|
-
end
|
216
|
-
|
217
|
-
def capture_response_block
|
218
|
-
captures = []
|
219
|
-
yield lambda {|chunk, remaining_bytes, total_bytes|
|
220
|
-
captures << [chunk, remaining_bytes, total_bytes]
|
221
|
-
}
|
222
|
-
captures
|
223
|
-
end
|
224
|
-
|
225
|
-
def launch_process(*args)
|
226
|
-
unless RUBY_PLATFORM == 'java'
|
227
|
-
GC.disable if RUBY_VERSION < '1.9'
|
228
|
-
pid, w, r, e = Open4.popen4(*args)
|
229
|
-
else
|
230
|
-
pid, w, r, e = IO.popen4(*args)
|
231
|
-
end
|
232
|
-
return pid, w, r, e
|
233
|
-
end
|
234
|
-
|
235
|
-
def cleanup_process(pid)
|
236
|
-
Process.kill(9, pid)
|
237
|
-
unless RUBY_PLATFORM == 'java'
|
238
|
-
GC.enable if RUBY_VERSION < '1.9'
|
239
|
-
Process.wait(pid)
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
def rackup_path(*parts)
|
244
|
-
File.expand_path(File.join(File.dirname(__FILE__), 'rackups', *parts))
|
245
|
-
end
|
246
|
-
|
247
|
-
def with_rackup(name, host="127.0.0.1")
|
248
|
-
pid, w, r, e = launch_process("rackup", "-s", "webrick", "--host", host, rackup_path(name))
|
249
|
-
until e.gets =~ /HTTPServer#start:/; end
|
250
|
-
yield
|
251
|
-
ensure
|
252
|
-
cleanup_process(pid)
|
253
|
-
|
254
|
-
# dump server errors
|
255
|
-
lines = e.read.split($/)
|
256
|
-
while line = lines.shift
|
257
|
-
case line
|
258
|
-
when /(ERROR|Error)/
|
259
|
-
unless line =~ /(null cert chain|did not return a certificate|SSL_read:: internal error)/
|
260
|
-
in_err = true
|
261
|
-
puts
|
262
|
-
end
|
263
|
-
when /^(127|localhost)/
|
264
|
-
in_err = false
|
265
|
-
end
|
266
|
-
puts line if in_err
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
def with_unicorn(name, listen='127.0.0.1:9292')
|
271
|
-
unless RUBY_PLATFORM == 'java'
|
272
|
-
unix_socket = listen.sub('unix://', '') if listen.start_with? 'unix://'
|
273
|
-
pid, w, r, e = launch_process("unicorn", "--no-default-middleware","-l", listen, rackup_path(name))
|
274
|
-
until e.gets =~ /worker=0 ready/; end
|
275
|
-
else
|
276
|
-
# need to find suitable server for jruby
|
277
|
-
end
|
278
|
-
yield
|
279
|
-
ensure
|
280
|
-
cleanup_process(pid)
|
281
|
-
|
282
|
-
if not unix_socket.nil? and File.exist?(unix_socket)
|
283
|
-
File.delete(unix_socket)
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
def server_path(*parts)
|
288
|
-
File.expand_path(File.join(File.dirname(__FILE__), 'servers', *parts))
|
289
|
-
end
|
290
|
-
|
291
|
-
def with_server(name)
|
292
|
-
pid, w, r, e = launch_process("ruby", server_path("#{name}.rb"))
|
293
|
-
until e.gets =~ /ready/; end
|
294
|
-
yield
|
295
|
-
ensure
|
296
|
-
cleanup_process(pid)
|
297
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
Shindo.tests('Excon thread safety') do
|
2
|
-
|
3
|
-
tests('thread_safe_sockets configuration') do
|
4
|
-
tests('thread_safe_sockets default').returns(true) do
|
5
|
-
connection = Excon.new('http://foo.com')
|
6
|
-
connection.data[:thread_safe_sockets]
|
7
|
-
end
|
8
|
-
|
9
|
-
tests('with thread_safe_sockets set false').returns(false) do
|
10
|
-
connection = Excon.new('http://foo.com', :thread_safe_sockets => false)
|
11
|
-
connection.data[:thread_safe_sockets]
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
with_rackup('thread_safety.ru') do
|
16
|
-
connection = Excon.new('http://127.0.0.1:9292')
|
17
|
-
|
18
|
-
long_thread = Thread.new {
|
19
|
-
response = connection.request(:method => 'GET', :path => '/id/1/wait/2')
|
20
|
-
Thread.current[:success] = response.body == '1'
|
21
|
-
}
|
22
|
-
|
23
|
-
short_thread = Thread.new {
|
24
|
-
response = connection.request(:method => 'GET', :path => '/id/2/wait/1')
|
25
|
-
Thread.current[:success] = response.body == '2'
|
26
|
-
}
|
27
|
-
|
28
|
-
test('long_thread') do
|
29
|
-
long_thread.join
|
30
|
-
short_thread.join
|
31
|
-
|
32
|
-
long_thread[:success]
|
33
|
-
end
|
34
|
-
|
35
|
-
test('short_thread') do
|
36
|
-
short_thread[:success]
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/tests/timeout_tests.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
Shindo.tests('read should timeout') do
|
2
|
-
with_rackup('timeout.ru') do
|
3
|
-
|
4
|
-
[false, true].each do |nonblock|
|
5
|
-
tests("nonblock => #{nonblock} hits read_timeout").raises(Excon::Errors::Timeout) do
|
6
|
-
connection = Excon.new('http://127.0.0.1:9292', :nonblock => nonblock)
|
7
|
-
connection.request(:method => :get, :path => '/timeout', :read_timeout => 1)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
end
|
12
|
-
end
|
data/tests/utils_tests.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
Shindo.tests('Excon::Utils') do
|
2
|
-
|
3
|
-
tests('#connection_uri') do
|
4
|
-
|
5
|
-
expected_uri = 'unix:///tmp/some.sock'
|
6
|
-
tests('using UNIX scheme').returns(expected_uri) do
|
7
|
-
connection = Excon.new('unix:///some/path', :socket => '/tmp/some.sock')
|
8
|
-
Excon::Utils.connection_uri(connection.data)
|
9
|
-
end
|
10
|
-
|
11
|
-
tests('using HTTP scheme') do
|
12
|
-
|
13
|
-
expected_uri = 'http://foo.com:80'
|
14
|
-
tests('with default port').returns(expected_uri) do
|
15
|
-
connection = Excon.new('http://foo.com/some/path')
|
16
|
-
Excon::Utils.connection_uri(connection.data)
|
17
|
-
end
|
18
|
-
|
19
|
-
expected_uri = 'http://foo.com'
|
20
|
-
tests('without default port').returns(expected_uri) do
|
21
|
-
connection = Excon.new('http://foo.com/some/path', :omit_default_port => true)
|
22
|
-
Excon::Utils.connection_uri(connection.data)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
tests('#request_uri') do
|
30
|
-
|
31
|
-
tests('using UNIX scheme') do
|
32
|
-
|
33
|
-
expected_uri = 'unix:///tmp/some.sock/some/path'
|
34
|
-
tests('without query').returns(expected_uri) do
|
35
|
-
connection = Excon.new('unix:/', :socket => '/tmp/some.sock')
|
36
|
-
params = { :path => '/some/path' }
|
37
|
-
Excon::Utils.request_uri(connection.data.merge(params))
|
38
|
-
end
|
39
|
-
|
40
|
-
expected_uri = 'unix:///tmp/some.sock/some/path?bar=that&foo=this'
|
41
|
-
tests('with query').returns(expected_uri) do
|
42
|
-
connection = Excon.new('unix:/', :socket => '/tmp/some.sock')
|
43
|
-
params = { :path => '/some/path', :query => { :foo => 'this', :bar => 'that' } }
|
44
|
-
Excon::Utils.request_uri(connection.data.merge(params))
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
tests('using HTTP scheme') do
|
50
|
-
|
51
|
-
expected_uri = 'http://foo.com:80/some/path'
|
52
|
-
tests('without query').returns(expected_uri) do
|
53
|
-
connection = Excon.new('http://foo.com')
|
54
|
-
params = { :path => '/some/path' }
|
55
|
-
Excon::Utils.request_uri(connection.data.merge(params))
|
56
|
-
end
|
57
|
-
|
58
|
-
expected_uri = 'http://foo.com:80/some/path?bar=that&foo=this'
|
59
|
-
tests('with query').returns(expected_uri) do
|
60
|
-
connection = Excon.new('http://foo.com')
|
61
|
-
params = { :path => '/some/path', :query => { :foo => 'this', :bar => 'that' } }
|
62
|
-
Excon::Utils.request_uri(connection.data.merge(params))
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
tests('#escape_uri').returns('/hello%20excon') do
|
70
|
-
Excon::Utils.escape_uri('/hello excon')
|
71
|
-
end
|
72
|
-
|
73
|
-
tests('#unescape_uri').returns('/hello excon') do
|
74
|
-
Excon::Utils.unescape_uri('/hello%20excon')
|
75
|
-
end
|
76
|
-
|
77
|
-
tests('#unescape_form').returns('message=We love excon!') do
|
78
|
-
Excon::Utils.unescape_form('message=We+love+excon!')
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|