We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3f5257 commit 22aff87Copy full SHA for 22aff87
spec/grape/middleware/exception_spec.rb
@@ -8,6 +8,17 @@ def call(env)
8
end
9
10
11
+
12
+ class AccessDeniedApp
13
+ class << self
14
+ def error!(message, status=403)
15
+ throw :error, :message => message, :status => status
16
+ end
17
+ def call(env)
18
+ error!("Access Denied", 401)
19
20
21
22
23
def app
24
@app
@@ -70,4 +81,13 @@ def app
70
81
last_response.body.should == '{:custom_formatter=>"rain!"}'
71
82
72
83
84
+ it 'should not trap regular error! codes' do
85
+ @app ||= Rack::Builder.app do
86
+ use Grape::Middleware::Error
87
+ run AccessDeniedApp
88
89
+ get '/'
90
+ last_response.status.should == 401
91
92
73
93
0 commit comments