lhc 15.1.2 → 15.1.3

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: 40a7523182b4a8d9a3a93cbc667d35e8df394f4751a1c6e9c0a6ccf71771f136
4
- data.tar.gz: d1c16ba4e9cf1ba5cbdaf0833b1c04daf48e3d039cdf4e445c249a6792c9a67f
3
+ metadata.gz: 329757321e8e5c7d51dc13addb0309cf887c25e052733c134c512e3fdc8025f9
4
+ data.tar.gz: bf32d7ceaf7b395066db2d04b8d225c2bfe863d9173f12853a4742256bb9d0db
5
5
  SHA512:
6
- metadata.gz: 3ab7127d698a59dfeeefaa06d8f80a8d787a7fde26017f4a026473826681a0d85373a560cdc82b8a7ef551be990149a26025a5d77af77b5b54b350f4ef528d78
7
- data.tar.gz: 12d1e327c10768fca97287b0efae094d966a3b291b5cf46933181a255a3245312b7fe68f63a232cd6aff50b10085e6dd1f9dfea2c6382fb1559075a9bb89fc23
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].merge!(bearer_token: token)
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
@@ -7,7 +7,7 @@ class LHC::Rollbar < LHC::Interceptor
7
7
  include LHC::FixInvalidEncodingConcern
8
8
 
9
9
  def after_response
10
- return unless Object.const_defined?('Rollbar')
10
+ return unless Object.const_defined?(:Rollbar)
11
11
  return if response.success?
12
12
 
13
13
  request = response.request
data/lib/lhc/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LHC
4
- VERSION ||= '15.1.2'
4
+ VERSION ||= '15.1.3'
5
5
  end
@@ -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?('Rollbar')
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhc
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.1.2
4
+ version: 15.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://github.com/local-ch/lhc/contributors