I am struggling with a strange problem. According to http://github.com/sinatra/sinatra (secion Filters), a response object is available after filter blocks in Sinatra 1.0. However, response.status is correctly accessible, I cannot see a non-empty response.body from my routes inside the filter after.
I have this file:
config.ru
require 'app'
run TestApp
Then the Sinatra 1.0.b stone is installed using:
gem install
And this is my little application with one route:
app.rb
require 'rubygems'
require 'sinatra/base'
class TestApp < Sinatra::Base
set :root, File.dirname(__FILE__)
get '/test' do
'Some response'
end
after do
halt 500 if response.empty?
end
end
And now I would like to access the answer inside the after filter. When I run this application and access the URL / test , I got a 500 response , as if the answer is empty, but the answer is clearly "Some response".
/ /favicon.ico 404, . , 500 , .
, , after /favicon.ico - - " ", /test , , .
?