Hello community, here is the log from the commit of package rubygem-faraday for openSUSE:Factory checked in at 2020-05-11 13:40:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-faraday (Old) and /work/SRC/openSUSE:Factory/.rubygem-faraday.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-faraday" Mon May 11 13:40:48 2020 rev:24 rq:802332 version:1.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-faraday/rubygem-faraday.changes 2020-03-07 21:38:01.112263236 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-faraday.new.2738/rubygem-faraday.changes 2020-05-11 13:40:48.577050192 +0200 @@ -1,0 +2,6 @@ +Thu May 7 20:41:45 UTC 2020 - Stephan Kulow <co...@suse.com> + +- updated to version 1.0.1 + see installed CHANGELOG.md + +------------------------------------------------------------------- Old: ---- faraday-1.0.0.gem New: ---- faraday-1.0.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-faraday.spec ++++++ --- /var/tmp/diff_new_pack.jR4YrP/_old 2020-05-11 13:40:49.441052025 +0200 +++ /var/tmp/diff_new_pack.jR4YrP/_new 2020-05-11 13:40:49.445052033 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-faraday -Version: 1.0.0 +Version: 1.0.1 Release: 0 %define mod_name faraday %define mod_full_name %{mod_name}-%{version} ++++++ faraday-1.0.0.gem -> faraday-1.0.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2020-01-01 01:05:57.000000000 +0100 +++ new/README.md 2020-03-29 15:54:36.000000000 +0200 @@ -1,4 +1,4 @@ -# ![Faraday](./docs/assets/img/repo-card-slim.png) +# [![Faraday](./docs/assets/img/repo-card-slim.png)][website] [![Gem Version](https://badge.fury.io/rb/faraday.svg)](https://rubygems.org/gems/faraday) ![GitHub Actions CI](https://github.com/lostisland/faraday/workflows/CI/badge.svg) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/UPGRADING.md new/UPGRADING.md --- old/UPGRADING.md 2020-01-01 01:05:57.000000000 +0100 +++ new/UPGRADING.md 1970-01-01 01:00:00.000000000 +0100 @@ -1,55 +0,0 @@ -## Faraday 1.0 - -### Errors -* Removes sub-class constants definition from `Faraday::Error`. A sub-class (e.g. `ClientError`) was previously accessible -either through the `Faraday` module (e.g. `Faraday::ClientError`) or through the `Faraday::Error` class (e.g. `Faraday::Error::ClientError`). -The latter is no longer available and the former should be used instead, so check your `rescue`s. -* Introduces a new `Faraday::ServerError` (5xx status codes) alongside the existing `Faraday::ClientError` (4xx status codes). -Please note `Faraday::ClientError` was previously used for both. -* Introduces new Errors that describe the most common REST status codes: - * Faraday::BadRequestError (400) - * Faraday::UnauthorizedError (401) - * Faraday::ForbiddenError (403) - * Faraday::ProxyAuthError (407). Please note this raised a `Faraday::ConnectionFailed` before. - * Faraday::ConflictError (409) - * Faraday::UnprocessableEntityError (422) -* The following error classes have changed the hierarchy to better mirror their real-world usage and semantic meaning: - * TimeoutError < ServerError (was < ClientError) - * ConnectionFailed < Error (was < ClientError) - * SSLError < Error (was < ClientError) - * ParsingError < Error (was < ClientError) - * RetriableResponse < Error (was < ClientError) - -### Custom adapters -If you have written a custom adapter, please be aware that `env.body` is now an alias to the two new properties `request_body` and `response_body`. -This should work without you noticing if your adapter inherits from `Faraday::Adapter` and calls `save_response`, but if it doesn't, then please ensure you set the `status` BEFORE the `body` while processing the response. - -### Others -* Dropped support for jruby and Rubinius. -* Officially supports Ruby 2.4+ -* In order to specify the adapter you now MUST use the `#adapter` method on the connection builder. If you don't do so and your adapter inherits from `Faraday::Adapter` then Faraday will raise an exception. Otherwise, Faraday will automatically push the default adapter at the end of the stack causing your request to be executed twice. -```ruby -class OfficialAdapter < Faraday::Adapter - ... -end - -class MyAdapter - ... -end - -# This will raise an exception -conn = Faraday.new(...) do |f| - f.use OfficialAdapter -end - -# This will cause Faraday inserting the default adapter at the end of the stack -conn = Faraday.new(...) do |f| - f.use MyAdapter -end - -# You MUST use `adapter` method -conn = Faraday.new(...) do |f| - f.adapter AnyAdapter -end -``` - Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/adapter/em_http.rb new/lib/faraday/adapter/em_http.rb --- old/lib/faraday/adapter/em_http.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/lib/faraday/adapter/em_http.rb 2020-03-29 15:54:36.000000000 +0200 @@ -142,7 +142,8 @@ raise Faraday::ConnectionFailed, e rescue StandardError => e - if defined?(OpenSSL) && e.is_a?(OpenSSL::SSL::SSLError) + if defined?(::OpenSSL::SSL::SSLError) && \ + e.is_a?(::OpenSSL::SSL::SSLError) raise Faraday::SSLError, e end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/adapter/httpclient.rb new/lib/faraday/adapter/httpclient.rb --- old/lib/faraday/adapter/httpclient.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/lib/faraday/adapter/httpclient.rb 2020-03-29 15:54:36.000000000 +0200 @@ -66,7 +66,8 @@ rescue Errno::EADDRNOTAVAIL, Errno::ECONNREFUSED, IOError, SocketError raise Faraday::ConnectionFailed, $ERROR_INFO rescue StandardError => e - if defined?(OpenSSL) && e.is_a?(OpenSSL::SSL::SSLError) + if defined?(::OpenSSL::SSL::SSLError) && \ + e.is_a?(::OpenSSL::SSL::SSLError) raise Faraday::SSLError, e end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/adapter/net_http.rb new/lib/faraday/adapter/net_http.rb --- old/lib/faraday/adapter/net_http.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/lib/faraday/adapter/net_http.rb 2020-03-29 15:54:36.000000000 +0200 @@ -30,8 +30,10 @@ Zlib::GzipFile::Error ] - exceptions << OpenSSL::SSL::SSLError if defined?(OpenSSL) - exceptions << Net::OpenTimeout if defined?(Net::OpenTimeout) + if defined?(::OpenSSL::SSL::SSLError) + exceptions << ::OpenSSL::SSL::SSLError + end + exceptions << ::Net::OpenTimeout if defined?(::Net::OpenTimeout) NET_HTTP_EXCEPTIONS = exceptions.freeze @@ -137,16 +139,24 @@ end def request_via_get_method(http, env, &block) - http.get env[:url].request_uri, env[:request_headers], &block + # Must use Net::HTTP#start and pass it a block otherwise the server's + # TCP socket does not close correctly. + http.start do |opened_http| + opened_http.get env[:url].request_uri, env[:request_headers], &block + end end def request_via_request_method(http, env, &block) - if block_given? - http.request create_request(env) do |response| - response.read_body(&block) + # Must use Net::HTTP#start and pass it a block otherwise the server's + # TCP socket does not close correctly. + http.start do |opened_http| + if block_given? + opened_http.request create_request(env) do |response| + response.read_body(&block) + end + else + opened_http.request create_request(env) end - else - http.request create_request(env) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/adapter/typhoeus.rb new/lib/faraday/adapter/typhoeus.rb --- old/lib/faraday/adapter/typhoeus.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/lib/faraday/adapter/typhoeus.rb 2020-03-29 15:54:36.000000000 +0200 @@ -3,7 +3,7 @@ module Faraday class Adapter # Typhoeus adapter. This class is just a stub, the real adapter is in - # https://github.com/philsturgeon/typhoeus/blob/master/lib/typhoeus/adapters/faraday.rb + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/adapters/faraday.rb class Typhoeus < Faraday::Adapter # Needs to define this method in order to support Typhoeus <= 1.3.0 def call; end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/adapter_registry.rb new/lib/faraday/adapter_registry.rb --- old/lib/faraday/adapter_registry.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/lib/faraday/adapter_registry.rb 2020-03-29 15:54:36.000000000 +0200 @@ -12,7 +12,9 @@ end def get(name) - klass = @constants[name] + klass = @lock.synchronize do + @constants[name] + end return klass if klass Object.const_get(name).tap { |c| set(c, name) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/request/authorization.rb new/lib/faraday/request/authorization.rb --- old/lib/faraday/request/authorization.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/lib/faraday/request/authorization.rb 2020-03-29 15:54:36.000000000 +0200 @@ -4,7 +4,9 @@ class Request # Request middleware for the Authorization HTTP header class Authorization < Faraday::Middleware - KEY = 'Authorization' unless defined? KEY + unless defined?(::Faraday::Request::Authorization::KEY) + KEY = 'Authorization' + end # @param type [String, Symbol] # @param token [String, Symbol, Hash] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/request/multipart.rb new/lib/faraday/request/multipart.rb --- old/lib/faraday/request/multipart.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/lib/faraday/request/multipart.rb 2020-03-29 15:54:36.000000000 +0200 @@ -8,7 +8,7 @@ # Middleware for supporting multi-part requests. class Multipart < UrlEncoded self.mime_type = 'multipart/form-data' - unless defined? DEFAULT_BOUNDARY_PREFIX + unless defined?(::Faraday::Request::Multipart::DEFAULT_BOUNDARY_PREFIX) DEFAULT_BOUNDARY_PREFIX = '-----------RubyMultipartPost' end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/request/url_encoded.rb new/lib/faraday/request/url_encoded.rb --- old/lib/faraday/request/url_encoded.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/lib/faraday/request/url_encoded.rb 2020-03-29 15:54:36.000000000 +0200 @@ -4,7 +4,9 @@ class Request # Middleware for supporting urlencoded requests. class UrlEncoded < Faraday::Middleware - CONTENT_TYPE = 'Content-Type' unless defined? CONTENT_TYPE + unless defined?(::Faraday::Request::UrlEncoded::CONTENT_TYPE) + CONTENT_TYPE = 'Content-Type' + end class << self attr_accessor :mime_type diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/response.rb new/lib/faraday/response.rb --- old/lib/faraday/response.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/lib/faraday/response.rb 2020-03-29 15:54:36.000000000 +0200 @@ -15,8 +15,11 @@ # Override this to modify the environment after the response has finished. # Calls the `parse` method if defined + # `parse` method can be defined as private, public and protected def on_complete(env) - env.body = parse(env.body) if respond_to?(:parse) && env.parse_body? + return unless respond_to?(:parse, true) && env.parse_body? + + env.body = parse(env.body) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday/utils.rb new/lib/faraday/utils.rb --- old/lib/faraday/utils.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/lib/faraday/utils.rb 2020-03-29 15:54:36.000000000 +0200 @@ -16,12 +16,20 @@ NestedParamsEncoder.encode(params) end + def default_space_encoding + @default_space_encoding ||= '+' + end + + class << self + attr_writer :default_space_encoding + end + ESCAPE_RE = /[^a-zA-Z0-9 .~_-]/.freeze def escape(str) str.to_s.gsub(ESCAPE_RE) do |match| '%' + match.unpack('H2' * match.bytesize).join('%').upcase - end.tr(' ', '+') + end.gsub(' ', default_space_encoding) end def unescape(str) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/faraday.rb new/lib/faraday.rb --- old/lib/faraday.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/lib/faraday.rb 2020-03-29 15:54:36.000000000 +0200 @@ -19,7 +19,7 @@ # conn.get '/' # module Faraday - VERSION = '1.0.0' + VERSION = '1.0.1' METHODS_WITH_QUERY = %w[get head delete trace].freeze METHODS_WITH_BODY = %w[post put patch].freeze @@ -153,7 +153,7 @@ @default_connection_options = ConnectionOptions.from(options) end - unless const_defined? :Timer + unless defined?(::Faraday::Timer) require 'timeout' Timer = Timeout end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2020-01-01 01:05:57.000000000 +0100 +++ new/metadata 2020-03-29 15:54:36.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: faraday version: !ruby/object:Gem::Version - version: 1.0.0 + version: 1.0.1 platform: ruby authors: - "@technoweenie" @@ -10,7 +10,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2020-01-01 00:00:00.000000000 Z +date: 2020-03-29 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: multipart-post @@ -42,7 +42,6 @@ - LICENSE.md - README.md - Rakefile -- UPGRADING.md - examples/client_spec.rb - examples/client_test.rb - lib/faraday.rb @@ -143,13 +142,14 @@ - MIT metadata: homepage_uri: https://lostisland.github.io/faraday - changelog_uri: https://github.com/lostisland/faraday/releases/tag/v1.0.0 + changelog_uri: https://github.com/lostisland/faraday/releases/tag/v1.0.1 source_code_uri: https://github.com/lostisland/faraday bug_tracker_uri: https://github.com/lostisland/faraday/issues post_install_message: rdoc_options: [] require_paths: - lib +- spec/external_adapters required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" @@ -161,7 +161,7 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.1.2 +rubygems_version: 3.0.3 signing_key: specification_version: 4 summary: HTTP/REST API client library. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/faraday/adapter/em_http_spec.rb new/spec/faraday/adapter/em_http_spec.rb --- old/spec/faraday/adapter/em_http_spec.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/spec/faraday/adapter/em_http_spec.rb 2020-03-29 15:54:36.000000000 +0200 @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe Faraday::Adapter::EMHttp do +RSpec.describe Faraday::Adapter::EMHttp, unless: defined?(JRUBY_VERSION) do features :request_body_on_query_methods, :reason_phrase_parse, :trace_method, :skip_response_body_on_head, :parallel, :local_socket_binding diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/faraday/adapter/em_synchrony_spec.rb new/spec/faraday/adapter/em_synchrony_spec.rb --- old/spec/faraday/adapter/em_synchrony_spec.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/spec/faraday/adapter/em_synchrony_spec.rb 2020-03-29 15:54:36.000000000 +0200 @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe Faraday::Adapter::EMSynchrony do +RSpec.describe Faraday::Adapter::EMSynchrony, unless: defined?(JRUBY_VERSION) do features :request_body_on_query_methods, :reason_phrase_parse, :skip_response_body_on_head, :parallel, :local_socket_binding diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/faraday/adapter/patron_spec.rb new/spec/faraday/adapter/patron_spec.rb --- old/spec/faraday/adapter/patron_spec.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/spec/faraday/adapter/patron_spec.rb 2020-03-29 15:54:36.000000000 +0200 @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe Faraday::Adapter::Patron do +RSpec.describe Faraday::Adapter::Patron, unless: defined?(JRUBY_VERSION) do features :reason_phrase_parse it_behaves_like 'an adapter' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/faraday/rack_builder_spec.rb new/spec/faraday/rack_builder_spec.rb --- old/spec/faraday/rack_builder_spec.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/spec/faraday/rack_builder_spec.rb 2020-03-29 15:54:36.000000000 +0200 @@ -189,7 +189,7 @@ it 'raises an error while making a request' do expect { conn.get('/') }.to raise_error(RuntimeError) do |err| - expect(err.message).to eq('missing dependency for Broken: cannot load such file -- zomg/i_dont/exist') + expect(err.message).to match(%r{missing dependency for Broken: .+ -- zomg/i_dont/exist}) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/faraday/request/url_encoded_spec.rb new/spec/faraday/request/url_encoded_spec.rb --- old/spec/faraday/request/url_encoded_spec.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/spec/faraday/request/url_encoded_spec.rb 2020-03-29 15:54:36.000000000 +0200 @@ -67,4 +67,17 @@ response = conn.post('/echo', 'a' => { 'b' => { 'c' => ['d'] } }) expect(response.body).to eq('a%5Bb%5D%5Bc%5D%5B%5D=d') end + + context 'customising default_space_encoding' do + around do |example| + Faraday::Utils.default_space_encoding = '%20' + example.run + Faraday::Utils.default_space_encoding = nil + end + + it 'uses the custom character to encode spaces' do + response = conn.post('/echo', str: 'apple banana') + expect(response.body).to eq('str=apple%20banana') + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/faraday/response/middleware_spec.rb new/spec/faraday/response/middleware_spec.rb --- old/spec/faraday/response/middleware_spec.rb 2020-01-01 01:05:57.000000000 +0100 +++ new/spec/faraday/response/middleware_spec.rb 2020-03-29 15:54:36.000000000 +0200 @@ -26,6 +26,22 @@ end end + context 'with a custom ResponseMiddleware and private parse' do + let(:custom_middleware) do + Class.new(Faraday::Response::Middleware) do + private + + def parse(body) + body.upcase + end + end + end + + it 'parses the response' do + expect(conn.get('ok').body).to eq('<BODY></BODY>') + end + end + context 'with a custom ResponseMiddleware but empty response' do let(:custom_middleware) do Class.new(Faraday::Response::Middleware) do