lhc 15.1.2 → 15.1.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 329757321e8e5c7d51dc13addb0309cf887c25e052733c134c512e3fdc8025f9
|
4
|
+
data.tar.gz: bf32d7ceaf7b395066db2d04b8d225c2bfe863d9173f12853a4742256bb9d0db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30e0b077eb4417c4825bdb493c4b3d6573bf7ccc5eccda46fb4296ac2b077b90103469cecc8d9fc0daea77f04993f63323934acb9183a0937563ce9813a92780
|
7
|
+
data.tar.gz: 98246e237ca676d313d82670257566a182e7099af102721b36b4fb339823c7bdbb54d579d652d71d188b9d9b0d3e2e1b9c741a67eed4db689399e385a59eb836
|
@@ -50,7 +50,10 @@ class LHC::Auth < LHC::Interceptor
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def set_bearer_authorization_header(token)
|
53
|
-
request.options[:auth]
|
53
|
+
auth_options = request.options[:auth] || {}
|
54
|
+
auth_options.merge!(bearer_token: token)
|
55
|
+
request.options[:auth] = auth_options unless request.options.key?(:auth)
|
56
|
+
|
54
57
|
set_authorization_header("Bearer #{token}")
|
55
58
|
end
|
56
59
|
# rubocop:enable Naming/AccessorMethodName
|
data/lib/lhc/version.rb
CHANGED
@@ -27,6 +27,27 @@ describe LHC::Auth do
|
|
27
27
|
expect(auth_suceeding_after_recovery).to have_been_made.once
|
28
28
|
end
|
29
29
|
|
30
|
+
context 'without `auth` options' do
|
31
|
+
let(:headers) do
|
32
|
+
{ 'Authorization' => "Bearer #{initial_token}" }
|
33
|
+
end
|
34
|
+
|
35
|
+
before do
|
36
|
+
LHC::Auth.refresh_client_token = -> { refresh_token }
|
37
|
+
end
|
38
|
+
|
39
|
+
after do
|
40
|
+
LHC::Auth.refresh_client_token = -> { nil }
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'recovery is attempted' do
|
44
|
+
LHC.config.endpoint(:local, 'http://local.ch')
|
45
|
+
# the retried request (with updated Bearer), that should work
|
46
|
+
LHC.get(:local, { headers: headers })
|
47
|
+
expect(auth_suceeding_after_recovery).to have_been_made.once
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
30
51
|
it "recovery is not attempted again when the request has reauthenticated: true " do
|
31
52
|
LHC.config.endpoint(:local, 'http://local.ch', auth: options.merge(reauthenticated: true))
|
32
53
|
expect { LHC.get(:local) }.to raise_error(LHC::Unauthorized)
|
@@ -9,7 +9,7 @@ describe LHC::Rollbar do
|
|
9
9
|
|
10
10
|
context 'Rollbar is undefined' do
|
11
11
|
before(:each) do
|
12
|
-
Object.send(:remove_const, 'Rollbar') if Object.const_defined?(
|
12
|
+
Object.send(:remove_const, 'Rollbar') if Object.const_defined?(:Rollbar)
|
13
13
|
end
|
14
14
|
it 'does not report' do
|
15
15
|
stub_request(:get, 'http://local.ch').to_return(status: 400)
|