grape-throttle 0.0.4 → 0.0.5
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 +4 -4
- data/lib/grape/middleware/throttle_middleware.rb +1 -1
- data/spec/simple_api_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2bc3d66275c45b179d7f9c3692f738601d74dc6
|
4
|
+
data.tar.gz: bf2fc95a5c5025123580883ec8183af7c16ef022
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18eda6a157f6f812af9382963093379db528e51b6fe6c00f059b806e39a2d7cd746c40529cc498edaeb5186ec5553817867b6ee7eac37716be49505fb8e80f32
|
7
|
+
data.tar.gz: d262d85427da186ca16c6ff2cc236b3b005549b38478f506dfcd8e2624743fb5e8e19edfe6e7533d7b4e4cf59a6c9b81ecac3d807c7b520c4196c9cc86c021ae
|
@@ -33,7 +33,7 @@ module Grape
|
|
33
33
|
redis.ping
|
34
34
|
current = redis.get(rate_key).to_i
|
35
35
|
if !current.nil? && current >= limit
|
36
|
-
endpoint.error!("too many requests, please try again later",
|
36
|
+
endpoint.error!("too many requests, please try again later", 429)
|
37
37
|
else
|
38
38
|
redis.multi do
|
39
39
|
# Set the value of the key to COUNTER_START if the key does not already exist and
|
data/spec/simple_api_spec.rb
CHANGED
@@ -43,7 +43,7 @@ describe "ThrottleHelper" do
|
|
43
43
|
|
44
44
|
it "is throttled beyond the rate limit" do
|
45
45
|
4.times { get "/throttle" }
|
46
|
-
expect(last_response.status).to eq(
|
46
|
+
expect(last_response.status).to eq(429)
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "with custom period" do
|
@@ -55,7 +55,7 @@ describe "ThrottleHelper" do
|
|
55
55
|
|
56
56
|
it "is throttled beyond the rate limit" do
|
57
57
|
4.times { get "/throttle-custom-period" }
|
58
|
-
expect(last_response.status).to eq(
|
58
|
+
expect(last_response.status).to eq(429)
|
59
59
|
end
|
60
60
|
|
61
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-throttle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Wainzinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack-test
|