lhc 10.4.0 → 10.4.1

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: 818f5150c8583bd190bf11aab7edf82aa4c42072f2fdd12d93552086f6693d27
4
- data.tar.gz: 9c2cf115d254de301d29b07f4d7a238506fa50878066355b25776498bde245ac
3
+ metadata.gz: 4c18e4ba62e228e3e5dc6e2650e328affdff5313678727e4e67bf1227e1cca81
4
+ data.tar.gz: b025952c55e322767e53974021e13a481eee200f675ed1de766f2bdd50f79e83
5
5
  SHA512:
6
- metadata.gz: 6430c14afed05c3aa09e4e05b5347c45db01f95bc46a8cd0ed47987bffe92cff256b1f944c6aaacc4697f6a0ed994e9a73b1a2ee89f51c331e6b742ac8b44cef
7
- data.tar.gz: 7a599bda71021fd43bcd7bc80712dd044d090268cbcfd31fc1d2f9feba9139dde906114d93e9c224c307a34e1ff73301cb0334eaf58c052a21b95ba339fdb8d5
6
+ metadata.gz: 6388cce68e50d90d10cd90b4c5a6421a0ae2515e73a4f473c4507d9a0136bd1ab724e4fbee0aefd52035e26cdb904504d788a4c8477b0e13aecf0cefd2ba87e9
7
+ data.tar.gz: fc9cd894ed6becd43043bf25ccdef204a4fb1028f7c7ec10b412dd445672f843211f7b912bd47082c13e02b515c2c989a7082003754f0ffb8e0f87eefb8862c2
@@ -45,7 +45,7 @@ class LHC::Throttle < LHC::Interceptor
45
45
  @limit ||= begin
46
46
  if options.is_a?(Integer)
47
47
  options
48
- elsif options.is_a?(Hash) && options[:header]
48
+ elsif options.is_a?(Hash) && options[:header] && response.headers.present?
49
49
  response.headers[options[:header]]&.to_i
50
50
  end
51
51
  end
@@ -53,7 +53,7 @@ class LHC::Throttle < LHC::Interceptor
53
53
 
54
54
  def remaining(options:, response:)
55
55
  @remaining ||= begin
56
- if options.is_a?(Hash) && options[:header]
56
+ if options.is_a?(Hash) && options[:header] && response.headers.present?
57
57
  response.headers[options[:header]]&.to_i
58
58
  end
59
59
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LHC
4
- VERSION ||= '10.4.0'
4
+ VERSION ||= '10.4.1'
5
5
  end
@@ -67,4 +67,15 @@ describe LHC::Throttle do
67
67
  end
68
68
  end
69
69
  end
70
+
71
+ context 'no response headers' do
72
+ before do
73
+ stub_request(:get, 'http://local.ch')
74
+ .to_return(status: 200)
75
+ end
76
+
77
+ it 'does not raise an exception' do
78
+ LHC.get('http://local.ch', options)
79
+ end
80
+ end
70
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhc
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.4.0
4
+ version: 10.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://github.com/local-ch/lhc/contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-17 00:00:00.000000000 Z
11
+ date: 2019-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport