faraday 0.8.11 → 0.9.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +6 -0
- data/CONTRIBUTING.md +36 -0
- data/Gemfile +7 -6
- data/LICENSE.md +1 -1
- data/README.md +38 -51
- data/Rakefile +2 -18
- data/faraday.gemspec +34 -0
- data/lib/faraday.rb +181 -67
- data/lib/faraday/adapter.rb +19 -34
- data/lib/faraday/adapter/em_http.rb +24 -10
- data/lib/faraday/adapter/em_synchrony.rb +1 -15
- data/lib/faraday/adapter/excon.rb +6 -12
- data/lib/faraday/adapter/httpclient.rb +92 -0
- data/lib/faraday/adapter/net_http.rb +2 -3
- data/lib/faraday/adapter/net_http_persistent.rb +3 -15
- data/lib/faraday/adapter/patron.rb +13 -21
- data/lib/faraday/adapter/rack.rb +0 -2
- data/lib/faraday/adapter/test.rb +35 -36
- data/lib/faraday/adapter/typhoeus.rb +10 -12
- data/lib/faraday/autoload.rb +87 -0
- data/lib/faraday/connection.rb +196 -99
- data/lib/faraday/error.rb +33 -33
- data/lib/faraday/options.rb +215 -0
- data/lib/faraday/parameters.rb +193 -0
- data/lib/faraday/{builder.rb → rack_builder.rb} +78 -21
- data/lib/faraday/request.rb +12 -25
- data/lib/faraday/request/authorization.rb +3 -3
- data/lib/faraday/request/basic_authentication.rb +1 -1
- data/lib/faraday/request/instrumentation.rb +38 -0
- data/lib/faraday/request/multipart.rb +10 -9
- data/lib/faraday/request/retry.rb +70 -6
- data/lib/faraday/request/token_authentication.rb +2 -2
- data/lib/faraday/request/url_encoded.rb +7 -6
- data/lib/faraday/response.rb +17 -22
- data/lib/faraday/response/logger.rb +4 -4
- data/lib/faraday/response/raise_error.rb +4 -5
- data/lib/faraday/utils.rb +54 -67
- data/script/console +7 -0
- data/script/release +6 -3
- data/script/server +3 -1
- data/script/test +7 -33
- data/test/adapters/em_http_test.rb +6 -1
- data/test/adapters/em_synchrony_test.rb +7 -1
- data/test/adapters/excon_test.rb +0 -7
- data/test/adapters/httpclient_test.rb +16 -0
- data/test/adapters/integration.rb +8 -39
- data/test/adapters/logger_test.rb +1 -1
- data/test/adapters/net_http_test.rb +0 -31
- data/test/adapters/patron_test.rb +1 -1
- data/test/adapters/rack_test.rb +0 -5
- data/test/adapters/test_middleware_test.rb +19 -4
- data/test/adapters/typhoeus_test.rb +20 -3
- data/test/authentication_middleware_test.rb +7 -7
- data/test/connection_test.rb +52 -75
- data/test/env_test.rb +33 -24
- data/test/helper.rb +15 -13
- data/test/live_server.rb +10 -4
- data/test/middleware/instrumentation_test.rb +75 -0
- data/test/middleware/retry_test.rb +44 -38
- data/test/middleware_stack_test.rb +12 -11
- data/test/options_test.rb +126 -0
- data/test/request_middleware_test.rb +17 -7
- data/test/response_middleware_test.rb +2 -4
- data/test/strawberry.rb +2 -0
- metadata +82 -28
- checksums.yaml +0 -7
- data/script/proxy-server +0 -41
- data/test/multibyte.txt +0 -1
- data/test/parameters_test.rb +0 -24
- data/test/utils_test.rb +0 -30
data/test/multibyte.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ファイル
|
data/test/parameters_test.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require File.expand_path("../helper", __FILE__)
|
2
|
-
|
3
|
-
class TestParameters < Faraday::TestCase
|
4
|
-
# emulates ActiveSupport::SafeBuffer#gsub
|
5
|
-
FakeSafeBuffer = Struct.new(:string) do
|
6
|
-
def to_s() self end
|
7
|
-
def gsub(regex)
|
8
|
-
string.gsub(regex) {
|
9
|
-
match, = $&, '' =~ /a/
|
10
|
-
yield(match)
|
11
|
-
}
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_escaping_safe_buffer_nested
|
16
|
-
monies = FakeSafeBuffer.new("$32,000.00")
|
17
|
-
assert_equal "a=%2432%2C000.00", Faraday::Utils.build_nested_query("a" => monies)
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_escaping_safe_buffer_flat
|
21
|
-
monies = FakeSafeBuffer.new("$32,000.00")
|
22
|
-
assert_equal "a=%2432%2C000.00", Faraday::Utils.build_query("a" => monies)
|
23
|
-
end
|
24
|
-
end
|
data/test/utils_test.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require File.expand_path('../helper', __FILE__)
|
2
|
-
|
3
|
-
class TestUtils < Faraday::TestCase
|
4
|
-
|
5
|
-
# emulates ActiveSupport::SafeBuffer#gsub
|
6
|
-
FakeSafeBuffer = Struct.new(:string) do
|
7
|
-
def to_s() self end
|
8
|
-
def gsub(regex)
|
9
|
-
string.gsub(regex) {
|
10
|
-
match, = $&, '' =~ /a/
|
11
|
-
yield match
|
12
|
-
}
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_escaping_safe_buffer
|
17
|
-
str = FakeSafeBuffer.new('$32,000.00')
|
18
|
-
assert_equal '%2432%2C000.00', Faraday::Utils.escape(str)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_replace_header_hash
|
22
|
-
headers = Faraday::Utils::Headers.new('authorization' => 't0ps3cr3t!')
|
23
|
-
assert headers.include?('authorization')
|
24
|
-
|
25
|
-
headers.replace({'content-type' => 'text/plain'})
|
26
|
-
|
27
|
-
assert !headers.include?('authorization')
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|