Pass in a :format with your normal params to trigger a response in that format.
get :index, :format => 'js'
No need to mess with your request headers.
Pass in a :format with your normal params to trigger a response in that format.
get :index, :format => 'js'
No need to mess with your request headers.