From 2f4aaed7b3feb3be787a316fab3144c06bb21a27 Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Fri, 27 Jun 2008 11:29:04 +0300 Subject: Disable the Accept header by default The accept header is poorly implemented by browsers and causes strange errors when used on public sites where crawlers make requests too. You should use formatted urls (e.g. /people/1.xml) to support API clients. Alternatively to re-enable it you need to set: config.action_controller.use_accept_header = true A special case remains for ajax requests which will have a javascript format for the base resource (/people/1) if the X-Requested-With header is present. This lets ajax pages still use format.js despite there being no params[:format] --- actionpack/test/controller/request_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/test/controller/request_test.rb') diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb index 20f3fd4d7b..932c0e21a1 100644 --- a/actionpack/test/controller/request_test.rb +++ b/actionpack/test/controller/request_test.rb @@ -386,7 +386,7 @@ class RequestTest < Test::Unit::TestCase def test_nil_format @request.instance_eval { @parameters = { :format => nil } } - @request.env["HTTP_ACCEPT"] = "text/javascript" + @request.env["HTTP_X_REQUESTED_WITH"] = "XMLHttpRequest" assert_equal Mime::JS, @request.format end -- cgit v1.2.3