rack-berater 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/berater/prioritizer.rb +2 -1
- data/lib/rack/berater/rspec.rb +9 -0
- data/lib/rack/berater/version.rb +1 -1
- data/spec/prioritizer_spec.rb +0 -5
- data/spec/rails_prioritizer_spec.rb +7 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5781e3d2d2b482f08801da66f94cda264ece7e1310bb0f5adaafefc12e5a61a5
|
4
|
+
data.tar.gz: b32888c349ced36fbdfb1b4c941dd32a45ba8a19a61c0cd553d3e208cbd39126
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92bc69dd2604250f0cdda1f5ab28ea3af4bb1059d6e284b5e51f70e15b5011a7a5f9bb2429a843b4b361081d95076f9483181d072617d1695e281630455b8101
|
7
|
+
data.tar.gz: 8ff2a5d2f76aabcd7b6e3a84a79be08591d8deaf995bbd99490be2e4bd9094406403ca161cb67aa1e30cb74325743373a391091d4285b233ba0adf5dc8578fab
|
@@ -9,6 +9,8 @@ module Rack
|
|
9
9
|
def initialize(app, options = {})
|
10
10
|
@app = app
|
11
11
|
@header = options[:header] || HEADER
|
12
|
+
|
13
|
+
synchronize { @@cache ||= {} }
|
12
14
|
end
|
13
15
|
|
14
16
|
def call(env)
|
@@ -57,7 +59,6 @@ module Rack
|
|
57
59
|
].join(':')
|
58
60
|
end
|
59
61
|
|
60
|
-
@@cache = {}
|
61
62
|
def cache_get(key)
|
62
63
|
synchronize { @@cache[key] }
|
63
64
|
end
|
data/lib/rack/berater/version.rb
CHANGED
data/spec/prioritizer_spec.rb
CHANGED
@@ -30,6 +30,7 @@ describe Rack::Berater::RailsPrioritizer do
|
|
30
30
|
get '/' => 'echo#index'
|
31
31
|
get '/six' => 'echo#six'
|
32
32
|
post '/nine' => 'echo#nine'
|
33
|
+
get '/redirect' => redirect('/')
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
@@ -37,8 +38,6 @@ describe Rack::Berater::RailsPrioritizer do
|
|
37
38
|
let(:middleware) { described_class.new(app) }
|
38
39
|
|
39
40
|
after do
|
40
|
-
cache.clear
|
41
|
-
Thread.current[described_class::ENV_KEY] = nil
|
42
41
|
Rails.application = nil
|
43
42
|
end
|
44
43
|
|
@@ -66,6 +65,12 @@ describe Rack::Berater::RailsPrioritizer do
|
|
66
65
|
subject.call(Rack::MockRequest.env_for('/nine'))
|
67
66
|
).to match %r{get:/nine}
|
68
67
|
end
|
68
|
+
|
69
|
+
it 'works with redirects' do
|
70
|
+
expect(
|
71
|
+
subject.call(Rack::MockRequest.env_for('/redirect'))
|
72
|
+
).to match %r{get:/redirect}
|
73
|
+
end
|
69
74
|
end
|
70
75
|
|
71
76
|
context 'when a priority header is sent' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-berater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Pepper
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- lib/rack/berater/prioritizer.rb
|
148
148
|
- lib/rack/berater/rails_prioritizer.rb
|
149
149
|
- lib/rack/berater/railtie.rb
|
150
|
+
- lib/rack/berater/rspec.rb
|
150
151
|
- lib/rack/berater/version.rb
|
151
152
|
- spec/limiter_spec.rb
|
152
153
|
- spec/prioritizer_spec.rb
|