faraday 0.8.9 → 0.8.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c87939e5902a41f09fffd6519d9db4bf1a74ebf1
4
- data.tar.gz: d865dcdc6a8dda8913ead8db02ecde8672b4a69c
3
+ metadata.gz: d43934c707a0fca6c31ccda1806c65af0c144b79
4
+ data.tar.gz: b30578af99d6349a20003d39441d66ee14f6992a
5
5
  SHA512:
6
- metadata.gz: 7767a066cdc2dbdf190b3077c8ce2da3b1d12fd010b00da3b5709ca779e3737024775c08648e339acd95ca07f07d9ac8587d1b26b14a99afa6af26b7be1a07f6
7
- data.tar.gz: 12b6d78d9a166235cfc2e54dd1d62582995ada6826b75871c512ea253a89b3c5bcf6f4f47219c596ff401079e43cd39e8271144f928899a8aa5596218d2bb0ec
6
+ metadata.gz: 8ad0e359c5aac602dd49f1c5c74a3009f0b42b5b42948f86cac8fd510603d46d75ab24ed30c4795903fc0b74cb0a828def6287f3dd097a37ec0e30ab673d2ca5
7
+ data.tar.gz: c713445a9a4efae7891594e8bb8bd7835ca32333db26df84d1e27f5eb8e80481683cea59a40afc42f31e9b4e6419605748410cf85cb75f598534e94870ea8219
data/Gemfile CHANGED
@@ -5,16 +5,18 @@ gem 'jruby-openssl', '~> 0.8.8', :platforms => :jruby
5
5
  gem 'rake'
6
6
 
7
7
  group :test do
8
+ gem 'test-unit'
8
9
  gem 'em-http-request', '>= 1.1', :require => 'em-http'
9
10
  gem 'em-synchrony', '>= 1.0', :require => ['em-synchrony', 'em-synchrony/em-http']
10
11
  gem 'excon', '>= 0.27.4'
11
12
  gem 'leftright', '>= 0.9', :require => false
13
+ gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
12
14
  gem 'net-http-persistent', '>= 2.5', :require => false
13
15
  gem 'patron', '>= 0.4.2', :platforms => :ruby
14
16
  gem 'rack-test', '>= 0.6', :require => 'rack/test'
15
17
  gem 'simplecov'
16
18
  gem 'sinatra', '~> 1.3'
17
- gem 'typhoeus', '~> 0.3.3', :platforms => :ruby
19
+ gem 'typhoeus', '~> 0.3.3', :platforms => [:ruby_18, :ruby_19, :ruby_20, :ruby_21]
18
20
  end
19
21
 
20
22
  gemspec
@@ -1,5 +1,5 @@
1
1
  module Faraday
2
- VERSION = "0.8.9"
2
+ VERSION = "0.8.10"
3
3
 
4
4
  class << self
5
5
  attr_accessor :root_path, :lib_path
@@ -24,6 +24,7 @@ module Faraday
24
24
  ]
25
25
 
26
26
  NET_HTTP_EXCEPTIONS << OpenSSL::SSL::SSLError if defined?(OpenSSL)
27
+ NET_HTTP_EXCEPTIONS << Net::OpenTimeout if defined?(Net::OpenTimeout)
27
28
 
28
29
  def call(env)
29
30
  super
@@ -81,7 +82,7 @@ module Faraday
81
82
  Net::HTTP::Proxy(proxy[:uri].host, proxy[:uri].port, proxy[:user], proxy[:password])
82
83
  else
83
84
  Net::HTTP
84
- end.new(env[:url].host, env[:url].port)
85
+ end.new(env[:url].host, env[:url].port || (env[:url].scheme == 'https' ? 443 : 80))
85
86
  end
86
87
 
87
88
  def configure_ssl(http, ssl)
@@ -52,8 +52,14 @@ module Faraday
52
52
  # HAX: helps but doesn't work completely
53
53
  # https://github.com/toland/patron/issues/34
54
54
  ::Patron::Request::VALID_ACTIONS.tap do |actions|
55
- actions << :patch unless actions.include? :patch
56
- actions << :options unless actions.include? :options
55
+ if actions[0].is_a?(Symbol)
56
+ actions << :patch unless actions.include? :patch
57
+ actions << :options unless actions.include? :options
58
+ else
59
+ # Patron 0.4.20 and up
60
+ actions << "PATCH" unless actions.include? "PATCH"
61
+ actions << "OPTIONS" unless actions.include? "OPTIONS"
62
+ end
57
63
  end
58
64
  end
59
65
 
@@ -149,7 +149,7 @@ run_test_files() {
149
149
 
150
150
  check_warnings() {
151
151
  # Display Ruby warnings from this project's source files. Abort if any were found.
152
- num="$(grep -F "$PWD" "$warnings" | grep -v "${PWD}/bundle" | sort | uniq -c | sort -rn | tee /dev/stderr | wc -l)"
152
+ num="$(grep -F "$PWD" "$warnings" | grep -v "${PWD}/vendor/bundle" | sort | uniq -c | sort -rn | tee /dev/stderr | wc -l)"
153
153
  rm -f "$warnings"
154
154
  if [ "$num" -gt 0 ]; then
155
155
  echo "FAILED: this test suite doesn't tolerate Ruby syntax warnings!" >&2
@@ -1,4 +1,6 @@
1
1
  require File.expand_path('../integration', __FILE__)
2
+ require 'ostruct'
3
+ require 'uri'
2
4
 
3
5
  module Adapters
4
6
  class NetHttpTest < Faraday::TestCase
@@ -10,5 +12,34 @@ module Adapters
10
12
 
11
13
  Integration.apply(self, *behaviors)
12
14
 
15
+ def test_no_explicit_http_port_number
16
+ url = URI('http://example.com')
17
+ url.port = nil
18
+
19
+ adapter = Faraday::Adapter::NetHttp.new
20
+ http = adapter.net_http_connection(:url => url, :request => {})
21
+
22
+ assert_equal 80, http.port
23
+ end
24
+
25
+ def test_no_explicit_https_port_number
26
+ url = URI('https://example.com')
27
+ url.port = nil
28
+
29
+ adapter = Faraday::Adapter::NetHttp.new
30
+ http = adapter.net_http_connection(:url => url, :request => {})
31
+
32
+ assert_equal 443, http.port
33
+ end
34
+
35
+ def test_explicit_port_number
36
+ url = URI('https://example.com:1234')
37
+
38
+ adapter = Faraday::Adapter::NetHttp.new
39
+ http = adapter.net_http_connection(:url => url, :request => {})
40
+
41
+ assert_equal 1234, http.port
42
+ end
43
+
13
44
  end
14
45
  end
@@ -11,7 +11,7 @@ module Adapters
11
11
 
12
12
  # https://github.com/toland/patron/issues/52
13
13
  undef :test_GET_with_body
14
- end unless jruby?
14
+ end unless RUBY_VERSION < '1.9' or jruby?
15
15
 
16
16
  end
17
17
  end
@@ -15,7 +15,7 @@ module Adapters
15
15
 
16
16
  # inconsistent outcomes ranging from successful response to connection error
17
17
  undef :test_proxy_auth_fail if ssl_mode?
18
- end unless jruby?
18
+ end unless jruby? or ruby_22_plus?
19
19
 
20
20
  end
21
21
  end
@@ -1,11 +1,10 @@
1
- unless ENV['CI']
2
- begin
3
- require 'simplecov'
4
- SimpleCov.start do
5
- add_filter 'test'
6
- add_filter '/bundle/'
7
- end
8
- rescue LoadError
1
+ if RUBY_VERSION >= '1.9'
2
+ require 'simplecov'
3
+
4
+ SimpleCov.start do
5
+ add_filter '/bundle/'
6
+ add_filter '/test/'
7
+ minimum_coverage(88.74)
9
8
  end
10
9
  end
11
10
 
@@ -71,6 +70,10 @@ module Faraday
71
70
  defined? RUBY_ENGINE and 'rbx' == RUBY_ENGINE
72
71
  end
73
72
 
73
+ def self.ruby_22_plus?
74
+ RUBY_VERSION > '2.2'
75
+ end
76
+
74
77
  def self.ssl_mode?
75
78
  ENV['SSL'] == 'yes'
76
79
  end
@@ -0,0 +1,24 @@
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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.9
4
+ version: 0.8.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Olson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-10 00:00:00.000000000 Z
11
+ date: 2015-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post
@@ -24,34 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.2.0
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: simplecov
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
27
  description:
56
28
  email: technoweenie@gmail.com
57
29
  executables: []
@@ -115,6 +87,7 @@ files:
115
87
  - test/middleware/retry_test.rb
116
88
  - test/middleware_stack_test.rb
117
89
  - test/multibyte.txt
90
+ - test/parameters_test.rb
118
91
  - test/request_middleware_test.rb
119
92
  - test/response_middleware_test.rb
120
93
  - test/utils_test.rb
@@ -143,4 +116,3 @@ signing_key:
143
116
  specification_version: 2
144
117
  summary: HTTP/REST API client library.
145
118
  test_files: []
146
- has_rdoc: