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 +4 -4
- data/lib/lhc/interceptors/throttle.rb +2 -2
- data/lib/lhc/version.rb +1 -1
- data/spec/interceptors/throttle/main_spec.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c18e4ba62e228e3e5dc6e2650e328affdff5313678727e4e67bf1227e1cca81
|
4
|
+
data.tar.gz: b025952c55e322767e53974021e13a481eee200f675ed1de766f2bdd50f79e83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/lhc/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2019-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|