excon 0.62.0 → 0.79.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE.md +1 -1
- data/README.md +5 -4
- data/data/cacert.pem +769 -1496
- data/excon.gemspec +17 -2
- data/lib/excon.rb +25 -17
- data/lib/excon/connection.rb +193 -119
- data/lib/excon/constants.rb +36 -13
- data/lib/excon/error.rb +15 -0
- data/lib/excon/headers.rb +4 -3
- data/lib/excon/instrumentors/logging_instrumentor.rb +4 -15
- data/lib/excon/instrumentors/standard_instrumentor.rb +2 -9
- data/lib/excon/middlewares/base.rb +6 -0
- data/lib/excon/middlewares/capture_cookies.rb +1 -1
- data/lib/excon/middlewares/decompress.rb +2 -2
- data/lib/excon/middlewares/expects.rb +7 -1
- data/lib/excon/middlewares/idempotent.rb +20 -3
- data/lib/excon/middlewares/instrumentor.rb +8 -0
- data/lib/excon/middlewares/mock.rb +12 -3
- data/lib/excon/middlewares/redirect_follower.rb +25 -3
- data/lib/excon/middlewares/response_parser.rb +3 -0
- data/lib/excon/pretty_printer.rb +1 -8
- data/lib/excon/response.rb +12 -9
- data/lib/excon/socket.rb +38 -21
- data/lib/excon/ssl_socket.rb +24 -13
- data/lib/excon/test/plugin/server/exec.rb +2 -2
- data/lib/excon/test/server.rb +1 -1
- data/lib/excon/unix_socket.rb +1 -0
- data/lib/excon/utils.rb +41 -5
- data/lib/excon/version.rb +1 -1
- metadata +27 -98
- data/.document +0 -5
- data/.gitignore +0 -13
- data/.rspec +0 -3
- data/.travis.yml +0 -29
- 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 -1083
- 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/requests/basic_spec.rb +0 -40
- data/spec/requests/eof_requests_spec.rb +0 -36
- data/spec/requests/unix_socket_spec.rb +0 -46
- data/spec/spec_helper.rb +0 -24
- data/spec/support/shared_contexts/test_server_context.rb +0 -83
- data/spec/support/shared_examples/shared_example_for_clients.rb +0 -218
- 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 -29
- data/tests/bad_tests.rb +0 -47
- 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 -20
- data/tests/data/127.0.0.1.cert.key +0 -27
- data/tests/data/excon.cert.crt +0 -20
- data/tests/data/excon.cert.key +0 -27
- data/tests/data/xs +0 -1
- data/tests/error_tests.rb +0 -145
- data/tests/header_tests.rb +0 -119
- 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 -206
- 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 -59
- data/tests/response_tests.rb +0 -197
- data/tests/servers/bad.rb +0 -20
- data/tests/servers/eof.rb +0 -17
- data/tests/servers/error.rb +0 -20
- data/tests/servers/good.rb +0 -350
- data/tests/test_helper.rb +0 -306
- data/tests/thread_safety_tests.rb +0 -39
- data/tests/timeout_tests.rb +0 -12
- data/tests/utils_tests.rb +0 -81
data/tests/batch_requests.rb
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
require 'shindo'
|
2
|
-
|
3
|
-
Shindo.tests('Batch Requests') do
|
4
|
-
with_server('good') do
|
5
|
-
tests('with batch request size 2') do
|
6
|
-
returns(%w{ 1 2 1 2 }, 'batch request size 2') do
|
7
|
-
connection = Excon.new('http://127.0.0.1:9292')
|
8
|
-
|
9
|
-
ret = []
|
10
|
-
ret << connection.batch_requests([
|
11
|
-
{:method => :get, :path => '/echo/request_count'},
|
12
|
-
{:method => :get, :path => '/echo/request_count'},
|
13
|
-
{:method => :get, :path => '/echo/request_count'},
|
14
|
-
{:method => :get, :path => '/echo/request_count'}
|
15
|
-
], 2).map(&:body)
|
16
|
-
|
17
|
-
ret.flatten
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
tests('peristent with batch request size 2') do
|
22
|
-
returns(%w{ 1 2 3 4 }, 'persistent batch request size 2') do
|
23
|
-
connection = Excon.new('http://127.0.0.1:9292', :persistent => true)
|
24
|
-
|
25
|
-
ret = []
|
26
|
-
ret << connection.batch_requests([
|
27
|
-
{:method => :get, :path => '/echo/request_count'},
|
28
|
-
{:method => :get, :path => '/echo/request_count'},
|
29
|
-
{:method => :get, :path => '/echo/request_count'},
|
30
|
-
{:method => :get, :path => '/echo/request_count'}
|
31
|
-
], 2).map(&:body)
|
32
|
-
|
33
|
-
ret.flatten
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
tests('with batch request size 3') do
|
38
|
-
returns(%w{ 1 2 3 1 }, 'batch request size 3') do
|
39
|
-
connection = Excon.new('http://127.0.0.1:9292')
|
40
|
-
|
41
|
-
ret = []
|
42
|
-
ret << connection.batch_requests([
|
43
|
-
{:method => :get, :path => '/echo/request_count'},
|
44
|
-
{:method => :get, :path => '/echo/request_count'},
|
45
|
-
{:method => :get, :path => '/echo/request_count'},
|
46
|
-
{:method => :get, :path => '/echo/request_count'}
|
47
|
-
], 3).map(&:body)
|
48
|
-
|
49
|
-
ret.flatten
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
tests('persistent with batch request size 3') do
|
54
|
-
returns(%w{ 1 2 3 4 }, 'persistent batch request size 3') do
|
55
|
-
connection = Excon.new('http://127.0.0.1:9292', :persistent => true)
|
56
|
-
|
57
|
-
ret = []
|
58
|
-
ret << connection.batch_requests([
|
59
|
-
{:method => :get, :path => '/echo/request_count'},
|
60
|
-
{:method => :get, :path => '/echo/request_count'},
|
61
|
-
{:method => :get, :path => '/echo/request_count'},
|
62
|
-
{:method => :get, :path => '/echo/request_count'}
|
63
|
-
], 3).map(&:body)
|
64
|
-
|
65
|
-
ret.flatten
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
tests('with batch request size 4') do
|
70
|
-
returns(%w{ 1 2 3 4 }, 'batch request size 4') do
|
71
|
-
connection = Excon.new('http://127.0.0.1:9292')
|
72
|
-
|
73
|
-
ret = []
|
74
|
-
ret << connection.batch_requests([
|
75
|
-
{:method => :get, :path => '/echo/request_count'},
|
76
|
-
{:method => :get, :path => '/echo/request_count'},
|
77
|
-
{:method => :get, :path => '/echo/request_count'},
|
78
|
-
{:method => :get, :path => '/echo/request_count'}
|
79
|
-
], 4).map(&:body)
|
80
|
-
|
81
|
-
ret.flatten
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
tests('persistent with batch request size 4') do
|
86
|
-
returns(%w{ 1 2 3 4 }, 'persistent batch request size 4') do
|
87
|
-
connection = Excon.new('http://127.0.0.1:9292', :persistent => true)
|
88
|
-
|
89
|
-
ret = []
|
90
|
-
ret << connection.batch_requests([
|
91
|
-
{:method => :get, :path => '/echo/request_count'},
|
92
|
-
{:method => :get, :path => '/echo/request_count'},
|
93
|
-
{:method => :get, :path => '/echo/request_count'},
|
94
|
-
{:method => :get, :path => '/echo/request_count'}
|
95
|
-
], 4).map(&:body)
|
96
|
-
|
97
|
-
ret.flatten
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
tests('with batch request size 8') do
|
102
|
-
returns(%w{ 1 2 3 4 }, 'batch request size 8') do
|
103
|
-
connection = Excon.new('http://127.0.0.1:9292')
|
104
|
-
|
105
|
-
ret = []
|
106
|
-
ret << connection.batch_requests([
|
107
|
-
{:method => :get, :path => '/echo/request_count'},
|
108
|
-
{:method => :get, :path => '/echo/request_count'},
|
109
|
-
{:method => :get, :path => '/echo/request_count'},
|
110
|
-
{:method => :get, :path => '/echo/request_count'}
|
111
|
-
], 8).map(&:body)
|
112
|
-
|
113
|
-
ret.flatten
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
tests('persistent with batch request size 8') do
|
118
|
-
returns(%w{ 1 2 3 4 }, 'persistent batch request size 8') do
|
119
|
-
connection = Excon.new('http://127.0.0.1:9292', :persistent => true)
|
120
|
-
|
121
|
-
ret = []
|
122
|
-
ret << connection.batch_requests([
|
123
|
-
{:method => :get, :path => '/echo/request_count'},
|
124
|
-
{:method => :get, :path => '/echo/request_count'},
|
125
|
-
{:method => :get, :path => '/echo/request_count'},
|
126
|
-
{:method => :get, :path => '/echo/request_count'}
|
127
|
-
], 8).map(&:body)
|
128
|
-
|
129
|
-
ret.flatten
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
data/tests/complete_responses.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
Shindo.tests('Excon Response Validation') do
|
2
|
-
env_init
|
3
|
-
|
4
|
-
with_server('good') do
|
5
|
-
tests('good responses with complete headers') do
|
6
|
-
100.times do
|
7
|
-
res = Excon.get('http://127.0.0.1:9292/chunked/simple')
|
8
|
-
returns(true) { res.body == "hello world" }
|
9
|
-
returns(true) { res.status_line == "HTTP/1.1 200 OK\r\n" }
|
10
|
-
returns(true) { res.status == 200}
|
11
|
-
returns(true) { res.reason_phrase == "OK" }
|
12
|
-
returns(true) { res.remote_ip == "127.0.0.1" }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
with_server('error') do
|
18
|
-
tests('error responses with complete headers') do
|
19
|
-
100.times do
|
20
|
-
res = Excon.get('http://127.0.0.1:9292/error/not_found')
|
21
|
-
returns(true) { res.body == "server says not found" }
|
22
|
-
returns(true) { res.status_line == "HTTP/1.1 404 Not Found\r\n" }
|
23
|
-
returns(true) { res.status == 404}
|
24
|
-
returns(true) { res.reason_phrase == "Not Found" }
|
25
|
-
returns(true) { res.remote_ip == "127.0.0.1" }
|
26
|
-
end
|
27
|
-
end
|
28
|
-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0B
|
14
|
-
AQsFAAOCAQEAWU6Q11wZFK6GhYK85IkW90FHug8/13DRJ3Q041ttQEpR48DW1lgj
|
15
|
-
5861hzKkYfyudJhk97WEnx2pzsZSogbiGv/jMT1otKk8RqQG/sQy/bqoTVZEg7I2
|
16
|
-
FyPCMV4fPFCm2dL7NTh51q0xeb9QFkxNFQ7YGtAvPSxs+GM/8gLxs4pSPMLSCNxX
|
17
|
-
0r6Lvook0ur+WXalGLu8110bCa4k+00SlZg0qZISlfrZyF5ofybylMjyy/qArgUy
|
18
|
-
8eltHfWbPhJEqf1yDPz2xCYGGCSplJMpvAhvSf4GSM55B27AoPlYlaS5wEaJf8Ft
|
19
|
-
g72ESuzICOQ617jOTeasIkkkoINIdnW1oA==
|
20
|
-
-----END CERTIFICATE-----
|
data/tests/data/excon.cert.key
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
-----BEGIN RSA PRIVATE KEY-----
|
2
|
-
MIIEowIBAAKCAQEAxZ527UceJuBMTm/FwDzbq+2WAMwoRg3s09KSEf5mMPP+dZnt
|
3
|
-
jsNwNw0ixbc13nc+xQbC9roWcGTSP/YYDCb5A7huMehTMHY7iuR4+yuGsA60ar24
|
4
|
-
g0qZwBLTL0+2X9lO/VCwpSLiUqMOhqXIdXyYSiGlY2X25Y7Ro35DYo13inRIeaU0
|
5
|
-
YBmT0GKJG88kmp6dnYPnUxsl0fk7c30WEufAgrp5VpRH9reV/mF2TIZiLf3OkbHj
|
6
|
-
tUb/qr2KzW35ZcFZpot1TSiYOGUfbzWSr4dpXdqQbqQqHvTEUZdT1hrurBH48D5a
|
7
|
-
QYk7rPzyrARJGkZl9JIGSWkzT6ohtg4/tlv08wIDAQABAoIBABpFHnocYh2442vp
|
8
|
-
39fWPz1zr+UbPp9RapIeA9zwfJU1WjY36CR6RoiK7nxqBnc0UtvOMkyqICGAxZJL
|
9
|
-
HJdA9wlPkxZ/U8+1Z+Tmyk5ZUuZEjidCYSzS1e16kyhO6GeFc8Ko31KUe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P2uPK1X9GASA1zgG6ay3FGH9m/vt36/DcRq
|
25
|
-
LQQP1WJUH8AR9/jlUgpS134Ww0AFVVh/ZHZTFnVkS8mn6wzFehxt49uVVcJncRzB
|
26
|
-
Vnes1S/Zky0RgvfR4rWy9NCYkIkqYAQPacfElxpGItV7V2INKFol
|
27
|
-
-----END RSA PRIVATE KEY-----
|
data/tests/data/xs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
data/tests/error_tests.rb
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Shindo.tests('HTTPStatusError request/response debugging') do
|
4
|
-
|
5
|
-
# Regression against e300458f2d9330cb265baeb8973120d08c665d9
|
6
|
-
tests('Excon::Error knows about pertinent errors') do
|
7
|
-
expected = [
|
8
|
-
100,
|
9
|
-
101,
|
10
|
-
(200..206).to_a,
|
11
|
-
(300..307).to_a,
|
12
|
-
(400..417).to_a,
|
13
|
-
422,
|
14
|
-
429,
|
15
|
-
(500..504).to_a
|
16
|
-
]
|
17
|
-
expected.flatten == Excon::Error.status_errors.keys
|
18
|
-
end
|
19
|
-
|
20
|
-
tests('new returns an Error').returns(true) do
|
21
|
-
Excon::Error.new('bar').class == Excon::Error
|
22
|
-
end
|
23
|
-
|
24
|
-
tests('new raises errors for bad URIs').returns(true) do
|
25
|
-
begin
|
26
|
-
Excon.new('foo')
|
27
|
-
false
|
28
|
-
rescue => err
|
29
|
-
err.to_s.include? 'foo'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
tests('new raises errors for bad paths').returns(true) do
|
34
|
-
begin
|
35
|
-
Excon.new('http://localhost', path: "foo\r\nbar: baz")
|
36
|
-
false
|
37
|
-
rescue => err
|
38
|
-
err.to_s.include? "foo\r\nbar: baz"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
tests('can raise standard error and catch standard error').returns(true) do
|
43
|
-
begin
|
44
|
-
raise Excon::Error::Client.new('foo')
|
45
|
-
rescue Excon::Error => e
|
46
|
-
true
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
tests('can raise legacy errors and catch legacy errors').returns(true) do
|
51
|
-
begin
|
52
|
-
raise Excon::Errors::Error.new('bar')
|
53
|
-
rescue Excon::Errors::Error => e
|
54
|
-
true
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
tests('can raise standard error and catch legacy errors').returns(true) do
|
59
|
-
begin
|
60
|
-
raise Excon::Error::NotFound.new('bar')
|
61
|
-
rescue Excon::Errors::Error => e
|
62
|
-
true
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
tests('can raise with status_error() and catch with standard error').returns(true) do
|
67
|
-
begin
|
68
|
-
raise Excon::Error.status_error({expects: 200}, {status: 400})
|
69
|
-
rescue Excon::Error
|
70
|
-
true
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
tests('can raise with status_error() and catch with legacy error').returns(true) do
|
76
|
-
begin
|
77
|
-
raise Excon::Error.status_error({expects: 200}, {status: 400})
|
78
|
-
rescue Excon::Errors::BadRequest
|
79
|
-
true
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
tests('can raise with legacy status_error() and catch with legacy').returns(true) do
|
84
|
-
begin
|
85
|
-
raise Excon::Errors.status_error({expects: 200}, {status: 400})
|
86
|
-
rescue Excon::Errors::BadRequest
|
87
|
-
true
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
|
92
|
-
tests('can raise with legacy status_error() and catch with standard').returns(true) do
|
93
|
-
begin
|
94
|
-
raise Excon::Errors.status_error({expects: 200}, {status: 400})
|
95
|
-
rescue Excon::Error
|
96
|
-
true
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
with_server('error') do
|
101
|
-
|
102
|
-
tests('message does not include response or response info').returns(true) do
|
103
|
-
begin
|
104
|
-
Excon.get('http://127.0.0.1:9292/error/not_found', :expects => 200)
|
105
|
-
rescue Excon::Errors::HTTPStatusError => err
|
106
|
-
err.message.include?('Expected(200) <=> Actual(404 Not Found)') &&
|
107
|
-
!err.message.include?('excon.error.request') &&
|
108
|
-
!err.message.include?('excon.error.response')
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
tests('message includes only request info').returns(true) do
|
113
|
-
begin
|
114
|
-
Excon.get('http://127.0.0.1:9292/error/not_found', :expects => 200,
|
115
|
-
:debug_request => true)
|
116
|
-
rescue Excon::Errors::HTTPStatusError => err
|
117
|
-
err.message.include?('Expected(200) <=> Actual(404 Not Found)') &&
|
118
|
-
err.message.include?('excon.error.request') &&
|
119
|
-
!err.message.include?('excon.error.response')
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
tests('message includes only response info').returns(true) do
|
124
|
-
begin
|
125
|
-
Excon.get('http://127.0.0.1:9292/error/not_found', :expects => 200,
|
126
|
-
:debug_response => true)
|
127
|
-
rescue Excon::Errors::HTTPStatusError => err
|
128
|
-
err.message.include?('Expected(200) <=> Actual(404 Not Found)') &&
|
129
|
-
!err.message.include?('excon.error.request') &&
|
130
|
-
err.message.include?('excon.error.response')
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
tests('message include request and response info').returns(true) do
|
135
|
-
begin
|
136
|
-
Excon.get('http://127.0.0.1:9292/error/not_found', :expects => 200,
|
137
|
-
:debug_request => true, :debug_response => true)
|
138
|
-
rescue Excon::Errors::HTTPStatusError => err
|
139
|
-
err.message.include?('Expected(200) <=> Actual(404 Not Found)') &&
|
140
|
-
err.message.include?('excon.error.request') &&
|
141
|
-
err.message.include?('excon.error.response')
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
data/tests/header_tests.rb
DELETED
@@ -1,119 +0,0 @@
|
|
1
|
-
Shindo.tests('Excon response header support') do
|
2
|
-
env_init
|
3
|
-
|
4
|
-
tests('Excon::Headers storage') do
|
5
|
-
headers = Excon::Headers.new
|
6
|
-
headers['Exact-Case'] = 'expected'
|
7
|
-
headers['Another-Fixture'] = 'another'
|
8
|
-
|
9
|
-
tests('stores and retrieves as received').returns('expected') do
|
10
|
-
headers['Exact-Case']
|
11
|
-
end
|
12
|
-
|
13
|
-
tests('enumerates keys as received') do
|
14
|
-
ks = headers.keys
|
15
|
-
tests('contains Exact-Case').returns(true) { ks.include? 'Exact-Case' }
|
16
|
-
tests('contains Another-Fixture').returns(true) { ks.include? 'Another-Fixture' }
|
17
|
-
end
|
18
|
-
|
19
|
-
tests('supports case-insensitive access').returns('expected') do
|
20
|
-
headers['EXACT-CASE']
|
21
|
-
end
|
22
|
-
|
23
|
-
tests('but still returns nil for missing keys').returns(nil) do
|
24
|
-
headers['Missing-Header']
|
25
|
-
end
|
26
|
-
|
27
|
-
tests('Hash methods that should support case-insensitive access') do
|
28
|
-
if {}.respond_to? :assoc
|
29
|
-
tests('#assoc').returns(%w{exact-case expected}) do
|
30
|
-
headers.assoc('exact-Case')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
tests('#delete') do
|
35
|
-
tests('with just a key').returns('yes') do
|
36
|
-
headers['Extra'] = 'yes'
|
37
|
-
headers.delete('extra')
|
38
|
-
end
|
39
|
-
|
40
|
-
tests('with a proc').returns('called with notpresent') do
|
41
|
-
headers.delete('notpresent') { |k| "called with #{k}" }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
tests('#fetch') do
|
46
|
-
tests('when present').returns('expected') { headers.fetch('exact-CASE') }
|
47
|
-
tests('with a default value').returns('default') { headers.fetch('missing', 'default') }
|
48
|
-
tests('with a default proc').returns('got missing') do
|
49
|
-
headers.fetch('missing') { |k| "got #{k}" }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
tests('#has_key?') do
|
54
|
-
tests('when present').returns(true) { headers.has_key?('EXACT-case') }
|
55
|
-
tests('when absent').returns(false) { headers.has_key?('missing') }
|
56
|
-
end
|
57
|
-
|
58
|
-
tests('#values_at') do
|
59
|
-
tests('all present').returns(%w{expected another}) do
|
60
|
-
headers.values_at('exACT-cASE', 'anotheR-fixturE')
|
61
|
-
end
|
62
|
-
tests('some missing').returns(['expected', nil]) do
|
63
|
-
headers.values_at('exact-case', 'missing-header')
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
with_rackup('response_header.ru') do
|
70
|
-
|
71
|
-
tests('Response#get_header') do
|
72
|
-
connection = nil
|
73
|
-
response = nil
|
74
|
-
|
75
|
-
tests('with variable header capitalization') do
|
76
|
-
|
77
|
-
tests('response.get_header("mixedcase-header")').returns('MixedCase') do
|
78
|
-
connection = Excon.new('http://foo.com:8080', :proxy => 'http://127.0.0.1:9292')
|
79
|
-
response = connection.request(:method => :get, :path => '/foo')
|
80
|
-
|
81
|
-
response.get_header("mixedcase-header")
|
82
|
-
end
|
83
|
-
|
84
|
-
tests('response.get_header("uppercase-header")').returns('UPPERCASE') do
|
85
|
-
response.get_header("uppercase-header")
|
86
|
-
end
|
87
|
-
|
88
|
-
tests('response.get_header("lowercase-header")').returns('lowercase') do
|
89
|
-
response.get_header("lowercase-header")
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
|
-
tests('when provided key capitalization varies') do
|
95
|
-
|
96
|
-
tests('response.get_header("MIXEDCASE-HEADER")').returns('MixedCase') do
|
97
|
-
response.get_header("MIXEDCASE-HEADER")
|
98
|
-
end
|
99
|
-
|
100
|
-
tests('response.get_header("MiXeDcAsE-hEaDeR")').returns('MixedCase') do
|
101
|
-
response.get_header("MiXeDcAsE-hEaDeR")
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
105
|
-
|
106
|
-
tests('when header is unavailable') do
|
107
|
-
|
108
|
-
tests('response.get_header("missing")').returns(nil) do
|
109
|
-
response.get_header("missing")
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
115
|
-
|
116
|
-
end
|
117
|
-
|
118
|
-
env_restore
|
119
|
-
end
|