If your controller action looks like this:
respond_to do |format| format.html { raise \'Unsupported\' } format.js # index.js.erb end
and yo
Pass in a :format with your normal params to trigger a response in that format.
:format
get :index, :format => 'js'
No need to mess with your request headers.