faraday 2.0.0.alpha.pre.3 → 2.0.0.alpha.pre.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f77dd46610919ce71119fc9b51f01a0b8d2e5294c279ca4849088d642c72e1d8
|
4
|
+
data.tar.gz: 8f6f37724b2f1d730b11f3c9bf2e3440e952e682c7728f9b5adef86a917cd1dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95ed69ec1d3ba8582309cf314c65f3718ee3feff7d15f7e7b75593e23c992c30df5243547618be0ff1bc17da1a346feb72ae5ce7460f10ec086061426270476d
|
7
|
+
data.tar.gz: 8d511875d592606eaab5aef9de57c86f083136ab022cb7cc6db56e4676ea9c6fde624378bca18db294f9dd6a0025fd96228baf5c92d93c539fbd7b6a5d2978d9
|
@@ -8,10 +8,11 @@ module Faraday
|
|
8
8
|
|
9
9
|
# @param app [#call]
|
10
10
|
# @param type [String, Symbol] Type of Authorization
|
11
|
-
# @param params [Array<String, Proc>] parameters to build the Authorization header.
|
11
|
+
# @param params [Array<String, Proc, #call>] parameters to build the Authorization header.
|
12
12
|
# If the type is `:basic`, then these can be a login and password pair.
|
13
13
|
# Otherwise, a single value is expected that will be appended after the type.
|
14
|
-
# This value can be a proc
|
14
|
+
# This value can be a proc or an object responding to `.call`, in which case
|
15
|
+
# it will be invoked on each request.
|
15
16
|
def initialize(app, type, *params)
|
16
17
|
@type = type
|
17
18
|
@params = params
|
@@ -37,7 +38,7 @@ module Faraday
|
|
37
38
|
raise ArgumentError, "Unexpected params received (got #{params.size} instead of 1)"
|
38
39
|
else
|
39
40
|
value = params.first
|
40
|
-
value = value.call if value.is_a?(Proc)
|
41
|
+
value = value.call if value.is_a?(Proc) || value.respond_to?(:call)
|
41
42
|
"#{type} #{value}"
|
42
43
|
end
|
43
44
|
end
|
data/lib/faraday/version.rb
CHANGED
@@ -63,6 +63,15 @@ RSpec.describe Faraday::Request::Authorization do
|
|
63
63
|
include_examples 'does not interfere with existing authentication'
|
64
64
|
end
|
65
65
|
|
66
|
+
context 'when passed a callable' do
|
67
|
+
let(:callable) { double('Callable Authorizer', call: 'custom_from_callable') }
|
68
|
+
let(:auth_config) { [callable] }
|
69
|
+
|
70
|
+
it { expect(response.body).to eq('Bearer custom_from_callable') }
|
71
|
+
|
72
|
+
include_examples 'does not interfere with existing authentication'
|
73
|
+
end
|
74
|
+
|
66
75
|
context 'when passed too many arguments' do
|
67
76
|
let(:auth_config) { %w[baz foo] }
|
68
77
|
|
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.0.0.alpha.pre.
|
4
|
+
version: 2.0.0.alpha.pre.4
|
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: 2021-
|
13
|
+
date: 2021-12-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multipart-post
|
@@ -137,7 +137,7 @@ licenses:
|
|
137
137
|
- MIT
|
138
138
|
metadata:
|
139
139
|
homepage_uri: https://lostisland.github.io/faraday
|
140
|
-
changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.0.0.alpha.pre.
|
140
|
+
changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.0.0.alpha.pre.4
|
141
141
|
source_code_uri: https://github.com/lostisland/faraday
|
142
142
|
bug_tracker_uri: https://github.com/lostisland/faraday/issues
|
143
143
|
post_install_message:
|