【发布时间】:2011-04-17 07:14:07
【问题描述】:
使用 Devise 进行身份验证。在具有以下功能的控制器上:
before_filter authenticate_user!, :except => [ :index, :show ]
我总是在经过身份验证的操作上获得304 Not Modified 状态代码而不是200 OK,即使在登录时在浏览器中也是如此。视图渲染和工作都很好。
它阻止了我的测试通过:
describe 'GET index' do
it 'should be successful' do
get 'index'
response.should be_success # Fails due to 304 status code
end
end
一开始我以为是我的控制器的错,但是除了before_filter和decent_exposure之外,控制器再普通不过了。
这个问题的根源可能是什么?
【问题讨论】:
-
304 只能在对 conditional GET request 的响应中返回。
标签: ruby-on-rails ruby-on-rails-3 http http-response-codes