faraday 2.13.0 → 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: b1bb65eef3cffcd2819dea033cc2f596b7626b3a7d9b2b0acde0c58a7160cb1e
4
- data.tar.gz: dd57fdb09a5aadb4689c2b20d65fada72ce224a14aa0d850a2916fd94f33c68d
3
+ metadata.gz: 7ab8d55c7b360596e25721ecc32dcf99c65cea19d04598bb468fc2a422e26146
4
+ data.tar.gz: 624ddc291aec0a438fded658897b2127d62b8fe10e00590e3ad0a609307711d6
5
5
  SHA512:
6
- metadata.gz: 6b96592916479cb638749ebdbacc44b7a622fba818fdbd92de981d47133f9f721dbf44895e877f8f7769415450dfb9d039389abcd6ad367dd6d012b3dfd56ab0
7
- data.tar.gz: 88bfc380df8d4e4454f40e29b245ccb6832860fac481645743e1543fb5bd9e057d19a0ff5a5679fcf58abfa7c50e50069afca7c2e352b08a7f1065a8239a0f6a
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.
@@ -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.13.0'
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
 
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.13.0
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.13.0
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: []