hobbit-contrib 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/hobbit/contrib/version.rb +1 -1
- data/lib/hobbit/filter.rb +3 -0
- data/spec/filter_spec.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55fab9ef331ed253a8f11ec44ae25fc53da572dd
|
4
|
+
data.tar.gz: 089a7b5a8fbbbb5454d48980c982cc89b6a7db82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72e7ecc6ea472c0003dc5b0ccd7f11c9e7b414d73e914cc283b5aeef0692c4da20b97b887375052142e0c751a813b04ff2f263b52383160d41087632a8d23ea5
|
7
|
+
data.tar.gz: 852457cfe4f155c9c81d8750d9d7b7f3a3aa6577b28aece8dd1369cf0243055cd854d28b627ca2575fdb21eb088d735a81d4edc327ddd29dfcbff292cc854b8f
|
data/CHANGELOG.md
CHANGED
data/lib/hobbit/filter.rb
CHANGED
@@ -32,7 +32,10 @@ module Hobbit
|
|
32
32
|
catch :halt do
|
33
33
|
filter :before
|
34
34
|
unless @response.status == 302
|
35
|
+
# we have to do this because `super` will override @response and @request
|
36
|
+
prev_response = @response
|
35
37
|
super
|
38
|
+
@response.headers.merge! prev_response.headers
|
36
39
|
filter :after unless @halted
|
37
40
|
end
|
38
41
|
end
|
data/spec/filter_spec.rb
CHANGED
@@ -209,7 +209,7 @@ EOS
|
|
209
209
|
end
|
210
210
|
|
211
211
|
get '/' do
|
212
|
-
halt 401,
|
212
|
+
halt 401, 'Unauthenticated'
|
213
213
|
end
|
214
214
|
end
|
215
215
|
end
|
@@ -217,7 +217,8 @@ EOS
|
|
217
217
|
it 'wont execute the after filter' do
|
218
218
|
get '/'
|
219
219
|
last_response.status.must_equal 401
|
220
|
-
last_response.headers.
|
220
|
+
last_response.headers.must_include 'Content-Type'
|
221
|
+
last_response.headers['Content-Type'].must_equal 'text/plain'
|
221
222
|
last_response.body.must_equal 'Unauthenticated'
|
222
223
|
end
|
223
224
|
end
|
@@ -240,7 +241,7 @@ EOS
|
|
240
241
|
it 'wont execute the route' do
|
241
242
|
get '/'
|
242
243
|
last_response.status.must_equal 401
|
243
|
-
last_response.body.
|
244
|
+
last_response.body.must_equal 'hello world'
|
244
245
|
end
|
245
246
|
end
|
246
247
|
end
|