faraday 2.12.3 → 2.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1434b95a4b157a48f4279e2341946ed2d2ca0fd5547e88cae6b531c6be1e3bb0
4
- data.tar.gz: 947e3e3751d9e2a717d4b28278285cc825eb292a93273d97571d3cde4f77f923
3
+ metadata.gz: 7ab8d55c7b360596e25721ecc32dcf99c65cea19d04598bb468fc2a422e26146
4
+ data.tar.gz: 624ddc291aec0a438fded658897b2127d62b8fe10e00590e3ad0a609307711d6
5
5
  SHA512:
6
- metadata.gz: 5e5d06c952784a9bd7f0b6a610188a0e00a8415fd5ccb35bc07fe4c9426fc5de10f8975bc069d85a13f5cc6f48ab291433d9565ab1f17112fac595e4aef50660
7
- data.tar.gz: 58b30aa3c0aa2d635839019358931fec2be300a8a59078240aea4541696e9aa5445106783d8281de0a1ec0e67c81ac9c3d1a08d2c4594caf14099753eb0b3d9d
6
+ metadata.gz: e2394c6ccb0b3e12d16e2dcd739d8ecf053199b40ce5d8d4a1902cc141c12746190e21b928e4979405ffcb2660db80a4777d46ee839df10f75cb66b34039285e
7
+ data.tar.gz: d91f5258bb49c40ff720aaba295ab4c86ea975cb7e0d4ad96647921e34924013501c1b4dddcf1c5497488fda0480ef39296f76b16188201f0162da004a490ba5
@@ -60,7 +60,7 @@ module Faraday
60
60
  :reason_phrase, :response_body) do
61
61
  const_set(:ContentLength, 'Content-Length')
62
62
  const_set(:StatusesWithoutBody, Set.new([204, 304]))
63
- const_set(:SuccessfulStatuses, (200..299))
63
+ const_set(:SuccessfulStatuses, 200..299)
64
64
 
65
65
  # A Set of HTTP verbs that typically send a body. If no body is set for
66
66
  # these requests, the Content-Length header is set to 0.
@@ -11,6 +11,9 @@ module Faraday
11
11
  # # @return [Boolean] whether to enable hostname verification on server certificates
12
12
  # # during the handshake or not (see https://github.com/ruby/openssl/pull/60)
13
13
  # #
14
+ # # @!attribute hostname
15
+ # # @return [String] Server hostname used for SNI (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL/SSLSocket.html#method-i-hostname-3D)
16
+ # #
14
17
  # # @!attribute ca_file
15
18
  # # @return [String] CA file
16
19
  # #
@@ -50,7 +53,7 @@ module Faraday
50
53
  # # @!attribute ciphers
51
54
  # # @return [String] cipher list in OpenSSL format (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL/SSLContext.html#method-i-ciphers-3D)
52
55
  # class SSLOptions < Options; end
53
- SSLOptions = Options.new(:verify, :verify_hostname,
56
+ SSLOptions = Options.new(:verify, :verify_hostname, :hostname,
54
57
  :ca_file, :ca_path, :verify_mode,
55
58
  :cert_store, :client_cert, :client_key,
56
59
  :certificate, :private_key, :verify_depth,
@@ -10,11 +10,13 @@ module Faraday
10
10
  # lifecycle to a given Logger object. By default, this logs to STDOUT. See
11
11
  # Faraday::Logging::Formatter to see specifically what is logged.
12
12
  class Logger < Middleware
13
+ DEFAULT_OPTIONS = { formatter: Logging::Formatter }.merge(Logging::Formatter::DEFAULT_OPTIONS).freeze
14
+
13
15
  def initialize(app, logger = nil, options = {})
14
- super(app)
16
+ super(app, options)
15
17
  logger ||= ::Logger.new($stdout)
16
- formatter_class = options.delete(:formatter) || Logging::Formatter
17
- @formatter = formatter_class.new(logger: logger, options: options)
18
+ formatter_class = @options.delete(:formatter)
19
+ @formatter = formatter_class.new(logger: logger, options: @options)
18
20
  yield @formatter if block_given?
19
21
  end
20
22
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Faraday
4
- VERSION = '2.12.3'
4
+ VERSION = '2.13.1'
5
5
  end
@@ -189,7 +189,7 @@ RSpec.describe Faraday::Response::Logger do
189
189
  context 'when logging request body' do
190
190
  let(:logger_options) { { bodies: { request: true } } }
191
191
 
192
- it 'log only request body' do
192
+ it 'logs only request body' do
193
193
  conn.post '/ohyes', 'name=Tamago', accept: 'text/html'
194
194
  expect(string_io.string).to match(%(name=Tamago))
195
195
  expect(string_io.string).not_to match(%(pebbles))
@@ -199,7 +199,7 @@ RSpec.describe Faraday::Response::Logger do
199
199
  context 'when logging response body' do
200
200
  let(:logger_options) { { bodies: { response: true } } }
201
201
 
202
- it 'log only response body' do
202
+ it 'logs only response body' do
203
203
  conn.post '/ohyes', 'name=Hamachi', accept: 'text/html'
204
204
  expect(string_io.string).to match(%(pebbles))
205
205
  expect(string_io.string).not_to match(%(name=Hamachi))
@@ -209,13 +209,13 @@ RSpec.describe Faraday::Response::Logger do
209
209
  context 'when logging request and response bodies' do
210
210
  let(:logger_options) { { bodies: true } }
211
211
 
212
- it 'log request and response body' do
212
+ it 'logs request and response body' do
213
213
  conn.post '/ohyes', 'name=Ebi', accept: 'text/html'
214
214
  expect(string_io.string).to match(%(name=Ebi))
215
215
  expect(string_io.string).to match(%(pebbles))
216
216
  end
217
217
 
218
- it 'log response body object' do
218
+ it 'logs response body object' do
219
219
  conn.get '/rubbles', nil, accept: 'text/html'
220
220
  expect(string_io.string).to match(%([\"Barney\", \"Betty\", \"Bam Bam\"]\n))
221
221
  end
@@ -228,6 +228,21 @@ RSpec.describe Faraday::Response::Logger do
228
228
  end
229
229
  end
230
230
 
231
+ context 'when bodies are logged by default' do
232
+ before do
233
+ described_class.default_options = { bodies: true }
234
+ end
235
+
236
+ it 'logs response body' do
237
+ conn.post '/ohai'
238
+ expect(string_io.string).to match(%(fred))
239
+ end
240
+
241
+ after do
242
+ described_class.default_options = { bodies: false }
243
+ end
244
+ end
245
+
231
246
  context 'when logging errors' do
232
247
  let(:logger_options) { { errors: true } }
233
248
 
@@ -104,6 +104,7 @@ RSpec.describe Faraday::Utils do
104
104
  min_version: nil,
105
105
  max_version: nil,
106
106
  verify_hostname: nil,
107
+ hostname: nil,
107
108
  ciphers: nil
108
109
  }
109
110
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.3
4
+ version: 2.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "@technoweenie"
@@ -9,7 +9,7 @@ authors:
9
9
  - "@olleolleolle"
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-04-08 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday-net_http
@@ -144,7 +144,7 @@ licenses:
144
144
  - MIT
145
145
  metadata:
146
146
  homepage_uri: https://lostisland.github.io/faraday
147
- changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.12.3
147
+ changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.13.1
148
148
  source_code_uri: https://github.com/lostisland/faraday
149
149
  bug_tracker_uri: https://github.com/lostisland/faraday/issues
150
150
  rubygems_mfa_required: 'true'
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  - !ruby/object:Gem::Version
164
164
  version: '0'
165
165
  requirements: []
166
- rubygems_version: 3.6.2
166
+ rubygems_version: 3.6.7
167
167
  specification_version: 4
168
168
  summary: HTTP/REST API client library.
169
169
  test_files: []