I used this code in an earlier(1.2.6) version of sinatra
我在sinatra的早期版本(1.2.6)中使用了这段代码
error 400..510 do |app|
do_something_with app.status
end
Here app.status
is the numeric code, i.e. a number between 400 and 510 that will be used in the response.
这里app.status是数字代码,即将在响应中使用的介于400和510之间的数字。
With a recent (1.3.2) version, this no longer works - app
is nil
. I've looked at the documentation and tried env['sinatra.error']
but that appears to be nil
as well.
最近(1.3.2)版本,这不再有效 - 应用程序是零。我查看了文档并尝试了env ['sinatra.error'],但这似乎也是零。
Is this still possible?
这还有可能吗?
1 个解决方案
#1
3
Have you tried response.status
? You can probably call it with just status
as I believe it's a helper.
你试过response.status吗?您可以使用状态调用它,因为我相信它是一个帮手。
#1
3
Have you tried response.status
? You can probably call it with just status
as I believe it's a helper.
你试过response.status吗?您可以使用状态调用它,因为我相信它是一个帮手。