halted filters and tests causing an error

I was wondering if this is a bug or perhaps an issue with how I'm using filters.

When a filter chain halts, nothing is sent back to the browser by default.

During tests, if a filter chain halts, the following error occurs because the response has no body.

NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.split     actionpack/lib/action_controller/integration.rb:291:in `parse_result'     actionpack/lib/action_controller/integration.rb:271:in `process'     actionpack/lib/action_controller/integration.rb:152:in `get'     actionpack/lib/action_controller/integration.rb:498:in `get'

Now I can add something like render(:nothing => true, :status => 401) to my filters if they fail, but that makes things look a bit messy.

Is this a bug in the integration code? Or am I doing something wrong?

Thanks, Andrew

It’s expected that you render or redirect in the filter before you cause it to halt. If you don’t render or redirect, how is your user supposed to know that something went wrong or how to fix it. For example, a login_required filter would redirect the user to the login url so that they can login and return to the page they were originally trying to access.

Hope that helps, Martin