Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-faraday for openSUSE:Factory 
checked in at 2022-12-13 18:56:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-faraday (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-faraday.new.1835 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-faraday"

Tue Dec 13 18:56:37 2022 rev:32 rq:1042635 version:2.7.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-faraday/rubygem-faraday.changes  
2022-10-12 18:26:23.533914478 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-faraday.new.1835/rubygem-faraday.changes    
    2022-12-13 18:56:55.791671592 +0100
@@ -1,0 +2,7 @@
+Wed Dec  7 11:20:05 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 2.7.1
+ see installed CHANGELOG.md
+
+
+-------------------------------------------------------------------

Old:
----
  faraday-2.6.0.gem

New:
----
  faraday-2.7.1.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-faraday.spec ++++++
--- /var/tmp/diff_new_pack.ncoDKV/_old  2022-12-13 18:56:56.883677420 +0100
+++ /var/tmp/diff_new_pack.ncoDKV/_new  2022-12-13 18:56:56.887677441 +0100
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-faraday
-Version:        2.6.0
+Version:        2.7.1
 Release:        0
 %define mod_name faraday
 %define mod_full_name %{mod_name}-%{version}

++++++ faraday-2.6.0.gem -> faraday-2.7.1.gem ++++++
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/logging/formatter.rb 
new/lib/faraday/logging/formatter.rb
--- old/lib/faraday/logging/formatter.rb        2022-10-03 18:29:46.000000000 
+0200
+++ new/lib/faraday/logging/formatter.rb        2022-11-18 12:09:30.000000000 
+0100
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'pp'
+require 'pp' # rubocop:disable Lint/RedundantRequireStatement
 
 module Faraday
   module Logging
@@ -8,7 +8,7 @@
     class Formatter
       extend Forwardable
 
-      DEFAULT_OPTIONS = { headers: true, bodies: false,
+      DEFAULT_OPTIONS = { headers: true, bodies: false, errors: false,
                           log_level: :info }.freeze
 
       def initialize(logger:, options:)
@@ -37,6 +37,18 @@
         log_body('response', env[:body]) if env[:body] && log_body?(:response)
       end
 
+      def error(error)
+        return unless log_errors?
+
+        error_log = proc { error.full_message }
+        public_send(log_level, 'error', &error_log)
+
+        log_headers('error', error.response_headers) if 
error.respond_to?(:response_headers) && log_headers?(:error)
+        return unless error.respond_to?(:response_body) && error.response_body 
&& log_body?(:error)
+
+        log_body('error', error.response_body)
+      end
+
       def filter(filter_word, filter_replacement)
         @filter.push([filter_word, filter_replacement])
       end
@@ -77,6 +89,10 @@
         end
       end
 
+      def log_errors?
+        @options[:errors]
+      end
+
       def apply_filters(output)
         @filter.each do |pattern, replacement|
           output = output.to_s.gsub(pattern, replacement)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/faraday/middleware.rb 
new/lib/faraday/middleware.rb
--- old/lib/faraday/middleware.rb       2022-10-03 18:29:46.000000000 +0200
+++ new/lib/faraday/middleware.rb       2022-11-18 12:09:30.000000000 +0100
@@ -17,6 +17,9 @@
       app.call(env).on_complete do |environment|
         on_complete(environment) if respond_to?(:on_complete)
       end
+    rescue StandardError => e
+      on_error(e) if respond_to?(:on_error)
+      raise
     end
 
     def close
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/faraday/response/logger.rb 
new/lib/faraday/response/logger.rb
--- old/lib/faraday/response/logger.rb  2022-10-03 18:29:46.000000000 +0200
+++ new/lib/faraday/response/logger.rb  2022-11-18 12:09:30.000000000 +0100
@@ -26,6 +26,10 @@
       def on_complete(env)
         @formatter.response(env)
       end
+
+      def on_error(error)
+        @formatter.error(error) if @formatter.respond_to?(:error)
+      end
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/faraday/utils/headers.rb 
new/lib/faraday/utils/headers.rb
--- old/lib/faraday/utils/headers.rb    2022-10-03 18:29:46.000000000 +0200
+++ new/lib/faraday/utils/headers.rb    2022-11-18 12:09:30.000000000 +0100
@@ -132,7 +132,12 @@
 
       # Join multiple values with a comma.
       def add_parsed(key, value)
-        self[key] ? self[key] << ', ' << value : self[key] = value
+        if key?(key)
+          self[key] = self[key].to_s
+          self[key] << ', ' << value
+        else
+          self[key] = value
+        end
       end
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/faraday/version.rb new/lib/faraday/version.rb
--- old/lib/faraday/version.rb  2022-10-03 18:29:46.000000000 +0200
+++ new/lib/faraday/version.rb  2022-11-18 12:09:30.000000000 +0100
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
 
 module Faraday
-  VERSION = '2.6.0'
+  VERSION = '2.7.1'
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2022-10-03 18:29:46.000000000 +0200
+++ new/metadata        2022-11-18 12:09:30.000000000 +0100
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: faraday
 version: !ruby/object:Gem::Version
-  version: 2.6.0
+  version: 2.7.1
 platform: ruby
 authors:
 - "@technoweenie"
@@ -10,7 +10,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2022-10-03 00:00:00.000000000 Z
+date: 2022-11-18 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: faraday-net_http
@@ -131,7 +131,7 @@
 - MIT
 metadata:
   homepage_uri: https://lostisland.github.io/faraday
-  changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.6.0
+  changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.7.1
   source_code_uri: https://github.com/lostisland/faraday
   bug_tracker_uri: https://github.com/lostisland/faraday/issues
 post_install_message: 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/faraday/middleware_spec.rb 
new/spec/faraday/middleware_spec.rb
--- old/spec/faraday/middleware_spec.rb 2022-10-03 18:29:46.000000000 +0200
+++ new/spec/faraday/middleware_spec.rb 2022-11-18 12:09:30.000000000 +0100
@@ -33,6 +33,24 @@
     end
   end
 
+  describe '#on_error' do
+    subject do
+      Class.new(described_class) do
+        def on_error(error)
+          # do nothing
+        end
+      end.new(app)
+    end
+
+    it 'is called by #call' do
+      expect(app).to receive(:call).and_raise(Faraday::ConnectionFailed)
+      is_expected.to receive(:call).and_call_original
+      is_expected.to receive(:on_error)
+
+      expect { subject.call(double) }.to raise_error(Faraday::ConnectionFailed)
+    end
+  end
+
   describe '#close' do
     context "with app that doesn't support \#close" do
       it 'should issue warning' do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/faraday/response/logger_spec.rb 
new/spec/faraday/response/logger_spec.rb
--- old/spec/faraday/response/logger_spec.rb    2022-10-03 18:29:46.000000000 
+0200
+++ new/spec/faraday/response/logger_spec.rb    2022-11-18 12:09:30.000000000 
+0100
@@ -64,6 +64,15 @@
       expect(formatter).to 
receive(:response).with(an_instance_of(Faraday::Env))
       conn.get '/hello'
     end
+
+    context 'when no route' do
+      it 'delegates logging to the formatter' do
+        expect(formatter).to 
receive(:request).with(an_instance_of(Faraday::Env))
+        expect(formatter).to 
receive(:error).with(an_instance_of(Faraday::Adapter::Test::Stubs::NotFound))
+
+        expect { conn.get '/noroute' }.to 
raise_error(Faraday::Adapter::Test::Stubs::NotFound)
+      end
+    end
   end
 
   context 'with custom formatter' do
@@ -94,6 +103,16 @@
     expect(string_io.string).to match('GET http:/hello')
   end
 
+  it 'logs status' do
+    conn.get '/hello', nil, accept: 'text/html'
+    expect(string_io.string).to match('Status 200')
+  end
+
+  it 'does not log error message by default' do
+    expect { conn.get '/noroute' }.to 
raise_error(Faraday::Adapter::Test::Stubs::NotFound)
+    expect(string_io.string).not_to match(%(no stubbed request for get 
http:/noroute))
+  end
+
   it 'logs request headers by default' do
     conn.get '/hello', nil, accept: 'text/html'
     expect(string_io.string).to match(%(Accept: "text/html))
@@ -188,6 +207,15 @@
     end
   end
 
+  context 'when logging errors' do
+    let(:logger_options) { { errors: true } }
+
+    it 'logs error message' do
+      expect { conn.get '/noroute' }.to 
raise_error(Faraday::Adapter::Test::Stubs::NotFound)
+      expect(string_io.string).to match(%(no stubbed request for get 
http:/noroute))
+    end
+  end
+
   context 'when using log_level' do
     let(:logger_options) { { bodies: true, log_level: :debug } }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/spec/faraday/utils/headers_spec.rb 
new/spec/faraday/utils/headers_spec.rb
--- old/spec/faraday/utils/headers_spec.rb      2022-10-03 18:29:46.000000000 
+0200
+++ new/spec/faraday/utils/headers_spec.rb      2022-11-18 12:09:30.000000000 
+0100
@@ -57,11 +57,11 @@
   end
 
   describe '#parse' do
-    before { subject.parse(headers) }
-
     context 'when response headers leave http status line out' do
       let(:headers) { "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n" }
 
+      before { subject.parse(headers) }
+
       it { expect(subject.keys).to eq(%w[Content-Type]) }
       it { expect(subject['Content-Type']).to eq('text/html') }
       it { expect(subject['content-type']).to eq('text/html') }
@@ -70,13 +70,31 @@
     context 'when response headers values include a colon' do
       let(:headers) { "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nLocation: 
http://httpbingo.org/\r\n\r\n"; }
 
+      before { subject.parse(headers) }
+
       it { expect(subject['location']).to eq('http://httpbingo.org/') }
     end
 
     context 'when response headers include a blank line' do
       let(:headers) { "HTTP/1.1 200 OK\r\n\r\nContent-Type: text/html\r\n\r\n" 
}
 
+      before { subject.parse(headers) }
+
       it { expect(subject['content-type']).to eq('text/html') }
     end
+
+    context 'when response headers include already stored keys' do
+      let(:headers) { "HTTP/1.1 200 OK\r\nX-Numbers: 123\r\n\r\n" }
+
+      before do
+        h = subject
+        h[:x_numbers] = 8
+        h.parse(headers)
+      end
+
+      it do
+        expect(subject[:x_numbers]).to eq('8, 123')
+      end
+    end
   end
 end

Reply via email to