faraday 2.9.2 → 2.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/lib/faraday/connection.rb +11 -3
- data/lib/faraday/error.rb +4 -0
- data/lib/faraday/middleware.rb +40 -1
- data/lib/faraday/options/ssl_options.rb +4 -1
- data/lib/faraday/response/raise_error.rb +17 -17
- data/lib/faraday/version.rb +1 -1
- data/spec/faraday/middleware_spec.rb +143 -0
- data/spec/faraday/response/raise_error_spec.rb +74 -10
- data/spec/faraday/utils_spec.rb +2 -1
- data/spec/support/faraday_middleware_subclasses.rb +18 -0
- metadata +36 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22c3a83dd32f012eb6d4bf4fe79b3e95ce44979ac19aee42a533d88f5c27848e
|
4
|
+
data.tar.gz: c07d8eda18dcde723ee2ab365a5d46272c88dab63cbadecd7f3d4af6e6133f9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 728dafd34ea29e515627f14bb254c83729ca66470961505d332994bf9ee52de85d43b97969fd0ce5cb9db22fbdf43b8ac0d64ee9447c336f5fcc6be6adc0d737
|
7
|
+
data.tar.gz: 1f28a98be9151d77ec729cabc40faa0c11cc27283382925452e6076e20cc5321b63732492d9dc10fb65a35977b18b957e636e72e22686c2467d91de9a038fae8
|
data/CHANGELOG.md
CHANGED
@@ -517,7 +517,7 @@ Breaking changes:
|
|
517
517
|
- Drop support for Ruby 1.8
|
518
518
|
|
519
519
|
Features:
|
520
|
-
- Include wrapped exception/
|
520
|
+
- Include wrapped exception/response in ClientErrors
|
521
521
|
- Add `response.reason_phrase`
|
522
522
|
- Provide option to selectively skip logging request/response headers
|
523
523
|
- Add regex support for pattern matching in `test` adapter
|
data/lib/faraday/connection.rb
CHANGED
@@ -314,15 +314,23 @@ module Faraday
|
|
314
314
|
#
|
315
315
|
# @yield a block to execute multiple requests.
|
316
316
|
# @return [void]
|
317
|
-
def in_parallel(manager = nil)
|
317
|
+
def in_parallel(manager = nil, &block)
|
318
318
|
@parallel_manager = manager || default_parallel_manager do
|
319
319
|
warn 'Warning: `in_parallel` called but no parallel-capable adapter ' \
|
320
320
|
'on Faraday stack'
|
321
321
|
warn caller[2, 10].join("\n")
|
322
322
|
nil
|
323
323
|
end
|
324
|
-
yield
|
325
|
-
|
324
|
+
return yield unless @parallel_manager
|
325
|
+
|
326
|
+
if @parallel_manager.respond_to?(:execute)
|
327
|
+
# Execute is the new method that is responsible for executing the block.
|
328
|
+
@parallel_manager.execute(&block)
|
329
|
+
else
|
330
|
+
# TODO: Old behaviour, deprecate and remove in 3.0
|
331
|
+
yield
|
332
|
+
@parallel_manager.run
|
333
|
+
end
|
326
334
|
ensure
|
327
335
|
@parallel_manager = nil
|
328
336
|
end
|
data/lib/faraday/error.rb
CHANGED
@@ -158,4 +158,8 @@ module Faraday
|
|
158
158
|
# Raised by middlewares that parse the response, like the JSON response middleware.
|
159
159
|
class ParsingError < Error
|
160
160
|
end
|
161
|
+
|
162
|
+
# Raised by Faraday::Middleware and subclasses when invalid default_options are used
|
163
|
+
class InitializationError < Error
|
164
|
+
end
|
161
165
|
end
|
data/lib/faraday/middleware.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'monitor'
|
4
|
+
|
3
5
|
module Faraday
|
4
6
|
# Middleware is the basic base class of any Faraday middleware.
|
5
7
|
class Middleware
|
@@ -7,9 +9,46 @@ module Faraday
|
|
7
9
|
|
8
10
|
attr_reader :app, :options
|
9
11
|
|
12
|
+
DEFAULT_OPTIONS = {}.freeze
|
13
|
+
LOCK = Mutex.new
|
14
|
+
|
10
15
|
def initialize(app = nil, options = {})
|
11
16
|
@app = app
|
12
|
-
@options = options
|
17
|
+
@options = self.class.default_options.merge(options)
|
18
|
+
end
|
19
|
+
|
20
|
+
class << self
|
21
|
+
# Faraday::Middleware::default_options= allows user to set default options at the Faraday::Middleware
|
22
|
+
# class level.
|
23
|
+
#
|
24
|
+
# @example Set the Faraday::Response::RaiseError option, `include_request` to `false`
|
25
|
+
# my_app/config/initializers/my_faraday_middleware.rb
|
26
|
+
#
|
27
|
+
# Faraday::Response::RaiseError.default_options = { include_request: false }
|
28
|
+
#
|
29
|
+
def default_options=(options = {})
|
30
|
+
validate_default_options(options)
|
31
|
+
LOCK.synchronize do
|
32
|
+
@default_options = default_options.merge(options)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# default_options attr_reader that initializes class instance variable
|
37
|
+
# with the values of any Faraday::Middleware defaults, and merges with
|
38
|
+
# subclass defaults
|
39
|
+
def default_options
|
40
|
+
@default_options ||= DEFAULT_OPTIONS.merge(self::DEFAULT_OPTIONS)
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def validate_default_options(options)
|
46
|
+
invalid_keys = options.keys.reject { |opt| self::DEFAULT_OPTIONS.key?(opt) }
|
47
|
+
return unless invalid_keys.any?
|
48
|
+
|
49
|
+
raise(Faraday::InitializationError,
|
50
|
+
"Invalid options provided. Keys not found in #{self}::DEFAULT_OPTIONS: #{invalid_keys.join(', ')}")
|
51
|
+
end
|
13
52
|
end
|
14
53
|
|
15
54
|
def call(env)
|
@@ -46,12 +46,15 @@ module Faraday
|
|
46
46
|
# #
|
47
47
|
# # @!attribute max_version
|
48
48
|
# # @return [String, Symbol] maximum SSL version (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL/SSLContext.html#method-i-max_version-3D)
|
49
|
+
# #
|
50
|
+
# # @!attribute ciphers
|
51
|
+
# # @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)
|
49
52
|
# class SSLOptions < Options; end
|
50
53
|
SSLOptions = Options.new(:verify, :verify_hostname,
|
51
54
|
:ca_file, :ca_path, :verify_mode,
|
52
55
|
:cert_store, :client_cert, :client_key,
|
53
56
|
:certificate, :private_key, :verify_depth,
|
54
|
-
:version, :min_version, :max_version) do
|
57
|
+
:version, :min_version, :max_version, :ciphers) do
|
55
58
|
# @return [Boolean] true if should verify
|
56
59
|
def verify?
|
57
60
|
verify != false
|
@@ -8,30 +8,30 @@ module Faraday
|
|
8
8
|
# rubocop:disable Naming/ConstantName
|
9
9
|
ClientErrorStatuses = (400...500)
|
10
10
|
ServerErrorStatuses = (500...600)
|
11
|
+
ClientErrorStatusesWithCustomExceptions = {
|
12
|
+
400 => Faraday::BadRequestError,
|
13
|
+
401 => Faraday::UnauthorizedError,
|
14
|
+
403 => Faraday::ForbiddenError,
|
15
|
+
404 => Faraday::ResourceNotFound,
|
16
|
+
408 => Faraday::RequestTimeoutError,
|
17
|
+
409 => Faraday::ConflictError,
|
18
|
+
422 => Faraday::UnprocessableEntityError,
|
19
|
+
429 => Faraday::TooManyRequestsError
|
20
|
+
}.freeze
|
11
21
|
# rubocop:enable Naming/ConstantName
|
12
22
|
|
23
|
+
DEFAULT_OPTIONS = { include_request: true, allowed_statuses: [] }.freeze
|
24
|
+
|
13
25
|
def on_complete(env)
|
26
|
+
return if Array(options[:allowed_statuses]).include?(env[:status])
|
27
|
+
|
14
28
|
case env[:status]
|
15
|
-
when
|
16
|
-
raise
|
17
|
-
when 401
|
18
|
-
raise Faraday::UnauthorizedError, response_values(env)
|
19
|
-
when 403
|
20
|
-
raise Faraday::ForbiddenError, response_values(env)
|
21
|
-
when 404
|
22
|
-
raise Faraday::ResourceNotFound, response_values(env)
|
29
|
+
when *ClientErrorStatusesWithCustomExceptions.keys
|
30
|
+
raise ClientErrorStatusesWithCustomExceptions[env[:status]], response_values(env)
|
23
31
|
when 407
|
24
32
|
# mimic the behavior that we get with proxy requests with HTTPS
|
25
33
|
msg = %(407 "Proxy Authentication Required")
|
26
34
|
raise Faraday::ProxyAuthError.new(msg, response_values(env))
|
27
|
-
when 408
|
28
|
-
raise Faraday::RequestTimeoutError, response_values(env)
|
29
|
-
when 409
|
30
|
-
raise Faraday::ConflictError, response_values(env)
|
31
|
-
when 422
|
32
|
-
raise Faraday::UnprocessableEntityError, response_values(env)
|
33
|
-
when 429
|
34
|
-
raise Faraday::TooManyRequestsError, response_values(env)
|
35
35
|
when ClientErrorStatuses
|
36
36
|
raise Faraday::ClientError, response_values(env)
|
37
37
|
when ServerErrorStatuses
|
@@ -58,7 +58,7 @@ module Faraday
|
|
58
58
|
|
59
59
|
# Include the request data by default. If the middleware was explicitly
|
60
60
|
# configured to _not_ include request data, then omit it.
|
61
|
-
return response unless options
|
61
|
+
return response unless options[:include_request]
|
62
62
|
|
63
63
|
response.merge(
|
64
64
|
request: {
|
data/lib/faraday/version.rb
CHANGED
@@ -67,4 +67,147 @@ RSpec.describe Faraday::Middleware do
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
70
|
+
|
71
|
+
describe '::default_options' do
|
72
|
+
let(:subclass_no_options) { FaradayMiddlewareSubclasses::SubclassNoOptions }
|
73
|
+
let(:subclass_one_option) { FaradayMiddlewareSubclasses::SubclassOneOption }
|
74
|
+
let(:subclass_two_options) { FaradayMiddlewareSubclasses::SubclassTwoOptions }
|
75
|
+
|
76
|
+
def build_conn(resp_middleware)
|
77
|
+
Faraday.new do |c|
|
78
|
+
c.adapter :test do |stub|
|
79
|
+
stub.get('/success') { [200, {}, 'ok'] }
|
80
|
+
end
|
81
|
+
c.response resp_middleware
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
RSpec.shared_context 'reset @default_options' do
|
86
|
+
before(:each) do
|
87
|
+
FaradayMiddlewareSubclasses::SubclassNoOptions.instance_variable_set(:@default_options, nil)
|
88
|
+
FaradayMiddlewareSubclasses::SubclassOneOption.instance_variable_set(:@default_options, nil)
|
89
|
+
FaradayMiddlewareSubclasses::SubclassTwoOptions.instance_variable_set(:@default_options, nil)
|
90
|
+
Faraday::Middleware.instance_variable_set(:@default_options, nil)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
after(:all) do
|
95
|
+
FaradayMiddlewareSubclasses::SubclassNoOptions.instance_variable_set(:@default_options, nil)
|
96
|
+
FaradayMiddlewareSubclasses::SubclassOneOption.instance_variable_set(:@default_options, nil)
|
97
|
+
FaradayMiddlewareSubclasses::SubclassTwoOptions.instance_variable_set(:@default_options, nil)
|
98
|
+
Faraday::Middleware.instance_variable_set(:@default_options, nil)
|
99
|
+
end
|
100
|
+
|
101
|
+
context 'with subclass DEFAULT_OPTIONS defined' do
|
102
|
+
include_context 'reset @default_options'
|
103
|
+
|
104
|
+
context 'and without application options configured' do
|
105
|
+
let(:resp1) { build_conn(:one_option).get('/success') }
|
106
|
+
|
107
|
+
it 'has only subclass defaults' do
|
108
|
+
expect(Faraday::Middleware.default_options).to eq(Faraday::Middleware::DEFAULT_OPTIONS)
|
109
|
+
expect(subclass_no_options.default_options).to eq(subclass_no_options::DEFAULT_OPTIONS)
|
110
|
+
expect(subclass_one_option.default_options).to eq(subclass_one_option::DEFAULT_OPTIONS)
|
111
|
+
expect(subclass_two_options.default_options).to eq(subclass_two_options::DEFAULT_OPTIONS)
|
112
|
+
end
|
113
|
+
|
114
|
+
it { expect(resp1.body).to eq('ok') }
|
115
|
+
end
|
116
|
+
|
117
|
+
context "and with one application's options changed" do
|
118
|
+
let(:resp2) { build_conn(:two_options).get('/success') }
|
119
|
+
|
120
|
+
before(:each) do
|
121
|
+
FaradayMiddlewareSubclasses::SubclassTwoOptions.default_options = { some_option: false }
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'only updates default options of target subclass' do
|
125
|
+
expect(Faraday::Middleware.default_options).to eq(Faraday::Middleware::DEFAULT_OPTIONS)
|
126
|
+
expect(subclass_no_options.default_options).to eq(subclass_no_options::DEFAULT_OPTIONS)
|
127
|
+
expect(subclass_one_option.default_options).to eq(subclass_one_option::DEFAULT_OPTIONS)
|
128
|
+
expect(subclass_two_options.default_options).to eq({ some_option: false, some_other_option: false })
|
129
|
+
end
|
130
|
+
|
131
|
+
it { expect(resp2.body).to eq('ok') }
|
132
|
+
end
|
133
|
+
|
134
|
+
context "and with two applications' options changed" do
|
135
|
+
let(:resp1) { build_conn(:one_option).get('/success') }
|
136
|
+
let(:resp2) { build_conn(:two_options).get('/success') }
|
137
|
+
|
138
|
+
before(:each) do
|
139
|
+
FaradayMiddlewareSubclasses::SubclassOneOption.default_options = { some_other_option: true }
|
140
|
+
FaradayMiddlewareSubclasses::SubclassTwoOptions.default_options = { some_option: false }
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'updates subclasses and parent independent of each other' do
|
144
|
+
expect(Faraday::Middleware.default_options).to eq(Faraday::Middleware::DEFAULT_OPTIONS)
|
145
|
+
expect(subclass_no_options.default_options).to eq(subclass_no_options::DEFAULT_OPTIONS)
|
146
|
+
expect(subclass_one_option.default_options).to eq({ some_other_option: true })
|
147
|
+
expect(subclass_two_options.default_options).to eq({ some_option: false, some_other_option: false })
|
148
|
+
end
|
149
|
+
|
150
|
+
it { expect(resp1.body).to eq('ok') }
|
151
|
+
it { expect(resp2.body).to eq('ok') }
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
context 'with FARADAY::MIDDLEWARE DEFAULT_OPTIONS and with Subclass DEFAULT_OPTIONS' do
|
156
|
+
before(:each) do
|
157
|
+
stub_const('Faraday::Middleware::DEFAULT_OPTIONS', { its_magic: false })
|
158
|
+
end
|
159
|
+
|
160
|
+
# Must stub Faraday::Middleware::DEFAULT_OPTIONS before resetting default options
|
161
|
+
include_context 'reset @default_options'
|
162
|
+
|
163
|
+
context 'and without application options configured' do
|
164
|
+
let(:resp1) { build_conn(:one_option).get('/success') }
|
165
|
+
|
166
|
+
it 'has only subclass defaults' do
|
167
|
+
expect(Faraday::Middleware.default_options).to eq(Faraday::Middleware::DEFAULT_OPTIONS)
|
168
|
+
expect(FaradayMiddlewareSubclasses::SubclassNoOptions.default_options).to eq({ its_magic: false })
|
169
|
+
expect(FaradayMiddlewareSubclasses::SubclassOneOption.default_options).to eq({ its_magic: false, some_other_option: false })
|
170
|
+
expect(FaradayMiddlewareSubclasses::SubclassTwoOptions.default_options).to eq({ its_magic: false, some_option: true, some_other_option: false })
|
171
|
+
end
|
172
|
+
|
173
|
+
it { expect(resp1.body).to eq('ok') }
|
174
|
+
end
|
175
|
+
|
176
|
+
context "and with two applications' options changed" do
|
177
|
+
let(:resp1) { build_conn(:one_option).get('/success') }
|
178
|
+
let(:resp2) { build_conn(:two_options).get('/success') }
|
179
|
+
|
180
|
+
before(:each) do
|
181
|
+
FaradayMiddlewareSubclasses::SubclassOneOption.default_options = { some_other_option: true }
|
182
|
+
FaradayMiddlewareSubclasses::SubclassTwoOptions.default_options = { some_option: false }
|
183
|
+
end
|
184
|
+
|
185
|
+
it 'updates subclasses and parent independent of each other' do
|
186
|
+
expect(Faraday::Middleware.default_options).to eq(Faraday::Middleware::DEFAULT_OPTIONS)
|
187
|
+
expect(FaradayMiddlewareSubclasses::SubclassNoOptions.default_options).to eq({ its_magic: false })
|
188
|
+
expect(FaradayMiddlewareSubclasses::SubclassOneOption.default_options).to eq({ its_magic: false, some_other_option: true })
|
189
|
+
expect(FaradayMiddlewareSubclasses::SubclassTwoOptions.default_options).to eq({ its_magic: false, some_option: false, some_other_option: false })
|
190
|
+
end
|
191
|
+
|
192
|
+
it { expect(resp1.body).to eq('ok') }
|
193
|
+
it { expect(resp2.body).to eq('ok') }
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
describe 'default_options input validation' do
|
198
|
+
include_context 'reset @default_options'
|
199
|
+
|
200
|
+
it 'raises error if Faraday::Middleware option does not exist' do
|
201
|
+
expect { Faraday::Middleware.default_options = { something_special: true } }.to raise_error(Faraday::InitializationError) do |e|
|
202
|
+
expect(e.message).to eq('Invalid options provided. Keys not found in Faraday::Middleware::DEFAULT_OPTIONS: something_special')
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
it 'raises error if subclass option does not exist' do
|
207
|
+
expect { subclass_one_option.default_options = { this_is_a_typo: true } }.to raise_error(Faraday::InitializationError) do |e|
|
208
|
+
expect(e.message).to eq('Invalid options provided. Keys not found in FaradayMiddlewareSubclasses::SubclassOneOption::DEFAULT_OPTIONS: this_is_a_typo')
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
70
213
|
end
|
@@ -194,18 +194,82 @@ RSpec.describe Faraday::Response::RaiseError do
|
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
197
|
+
describe 'DEFAULT_OPTION: include_request' do
|
198
|
+
before(:each) do
|
199
|
+
Faraday::Response::RaiseError.instance_variable_set(:@default_options, nil)
|
200
|
+
Faraday::Middleware.instance_variable_set(:@default_options, nil)
|
201
|
+
end
|
202
|
+
|
203
|
+
after(:all) do
|
204
|
+
Faraday::Response::RaiseError.instance_variable_set(:@default_options, nil)
|
205
|
+
Faraday::Middleware.instance_variable_set(:@default_options, nil)
|
206
|
+
end
|
207
|
+
|
208
|
+
context 'when RaiseError DEFAULT_OPTION (include_request: true) is used' do
|
209
|
+
it 'includes request info in the exception' do
|
210
|
+
expect { perform_request }.to raise_error(Faraday::BadRequestError) do |ex|
|
211
|
+
expect(ex.response.keys).to contain_exactly(
|
212
|
+
:status,
|
213
|
+
:headers,
|
214
|
+
:body,
|
215
|
+
:request
|
216
|
+
)
|
217
|
+
end
|
207
218
|
end
|
208
219
|
end
|
220
|
+
|
221
|
+
context 'when application sets default_options `include_request: false`' do
|
222
|
+
before(:each) do
|
223
|
+
Faraday::Response::RaiseError.default_options = { include_request: false }
|
224
|
+
end
|
225
|
+
|
226
|
+
context 'and when include_request option is omitted' do
|
227
|
+
it 'does not include request info in the exception' do
|
228
|
+
expect { perform_request }.to raise_error(Faraday::BadRequestError) do |ex|
|
229
|
+
expect(ex.response.keys).to contain_exactly(
|
230
|
+
:status,
|
231
|
+
:headers,
|
232
|
+
:body
|
233
|
+
)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
context 'and when include_request option is explicitly set for instance' do
|
239
|
+
let(:middleware_options) { { include_request: true } }
|
240
|
+
|
241
|
+
it 'includes request info in the exception' do
|
242
|
+
expect { perform_request }.to raise_error(Faraday::BadRequestError) do |ex|
|
243
|
+
expect(ex.response.keys).to contain_exactly(
|
244
|
+
:status,
|
245
|
+
:headers,
|
246
|
+
:body,
|
247
|
+
:request
|
248
|
+
)
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
describe 'allowing certain status codes' do
|
257
|
+
let(:conn) do
|
258
|
+
Faraday.new do |b|
|
259
|
+
b.response :raise_error, allowed_statuses: [404]
|
260
|
+
b.adapter :test do |stub|
|
261
|
+
stub.get('bad-request') { [400, { 'X-Reason' => 'because' }, 'keep looking'] }
|
262
|
+
stub.get('not-found') { [404, { 'X-Reason' => 'because' }, 'keep looking'] }
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
it 'raises an error for status codes that are not explicitly allowed' do
|
268
|
+
expect { conn.get('bad-request') }.to raise_error(Faraday::BadRequestError)
|
269
|
+
end
|
270
|
+
|
271
|
+
it 'does not raise an error for allowed status codes' do
|
272
|
+
expect { conn.get('not-found') }.not_to raise_error
|
209
273
|
end
|
210
274
|
end
|
211
275
|
end
|
data/spec/faraday/utils_spec.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FaradayMiddlewareSubclasses
|
4
|
+
class SubclassNoOptions < Faraday::Middleware
|
5
|
+
end
|
6
|
+
|
7
|
+
class SubclassOneOption < Faraday::Middleware
|
8
|
+
DEFAULT_OPTIONS = { some_other_option: false }.freeze
|
9
|
+
end
|
10
|
+
|
11
|
+
class SubclassTwoOptions < Faraday::Middleware
|
12
|
+
DEFAULT_OPTIONS = { some_option: true, some_other_option: false }.freeze
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
Faraday::Response.register_middleware(no_options: FaradayMiddlewareSubclasses::SubclassNoOptions)
|
17
|
+
Faraday::Response.register_middleware(one_option: FaradayMiddlewareSubclasses::SubclassOneOption)
|
18
|
+
Faraday::Response.register_middleware(two_options: FaradayMiddlewareSubclasses::SubclassTwoOptions)
|
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.
|
4
|
+
version: 2.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "@technoweenie"
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-09-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday-net_http
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '2.0'
|
22
22
|
- - "<"
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: '3.
|
24
|
+
version: '3.4'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -31,7 +31,35 @@ dependencies:
|
|
31
31
|
version: '2.0'
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '3.
|
34
|
+
version: '3.4'
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: json
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
type: :runtime
|
43
|
+
prerelease: false
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: logger
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
35
63
|
description:
|
36
64
|
email: technoweenie@gmail.com
|
37
65
|
executables: []
|
@@ -107,6 +135,7 @@ files:
|
|
107
135
|
- spec/spec_helper.rb
|
108
136
|
- spec/support/disabling_stub.rb
|
109
137
|
- spec/support/fake_safe_buffer.rb
|
138
|
+
- spec/support/faraday_middleware_subclasses.rb
|
110
139
|
- spec/support/helper_methods.rb
|
111
140
|
- spec/support/shared_examples/adapter.rb
|
112
141
|
- spec/support/shared_examples/params_encoder.rb
|
@@ -117,9 +146,10 @@ licenses:
|
|
117
146
|
- MIT
|
118
147
|
metadata:
|
119
148
|
homepage_uri: https://lostisland.github.io/faraday
|
120
|
-
changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.
|
149
|
+
changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.12.0
|
121
150
|
source_code_uri: https://github.com/lostisland/faraday
|
122
151
|
bug_tracker_uri: https://github.com/lostisland/faraday/issues
|
152
|
+
rubygems_mfa_required: 'true'
|
123
153
|
post_install_message:
|
124
154
|
rdoc_options: []
|
125
155
|
require_paths:
|
@@ -136,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
166
|
- !ruby/object:Gem::Version
|
137
167
|
version: '0'
|
138
168
|
requirements: []
|
139
|
-
rubygems_version: 3.5.
|
169
|
+
rubygems_version: 3.5.16
|
140
170
|
signing_key:
|
141
171
|
specification_version: 4
|
142
172
|
summary: HTTP/REST API client library.
|