Skip to content

Commit 4ce9931

Browse files
committed
Reenable the use of the Accept header to give people a chance to update their applications and provide feedback.
1 parent 6b61e95 commit 4ce9931

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

actionpack/CHANGELOG

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44

55
* Add :recursive option to javascript_include_tag and stylesheet_link_tag to be used along with :all. #480 [Damian Janowski]
66

7-
* Disable the Accept header by default [Michael Koziarski]
7+
* Allow users to disable the use of the Accept header [Michael Koziarski]
88

99
The accept header is poorly implemented by browsers and causes strange
1010
errors when used on public sites where crawlers make requests too. You
11-
should use formatted urls (e.g. /people/1.xml) to support API clients.
11+
can use formatted urls (e.g. /people/1.xml) to support API clients in a
12+
much simpler way.
1213

13-
Alternatively to re-enable it you need to set:
14+
To disable the header you need to set:
1415

15-
config.action_controller.use_accept_header = true
16+
config.action_controller.use_accept_header = false
1617

1718
* Do not stat template files in production mode before rendering. You will no longer be able to modify templates in production mode without restarting the server [Josh Peek]
1819

actionpack/lib/action_controller/base.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,12 @@ class Base
343343
# Indicates whether the response format should be determined by examining the Accept HTTP header,
344344
# or by using the simpler params + ajax rules.
345345
#
346-
# If this is set to +true+ then +respond_to+ and +Request#format+ will take the Accept header into
347-
# account. If it is set to false (the default) then the request format will be determined solely
346+
# If this is set to +true+ (the default) then +respond_to+ and +Request#format+ will take the Accept
347+
# header into account. If it is set to false then the request format will be determined solely
348348
# by examining params[:format]. If params format is missing, the format will be either HTML or
349349
# Javascript depending on whether the request is an AJAX request.
350350
cattr_accessor :use_accept_header
351-
self.use_accept_header = false
351+
self.use_accept_header = true
352352

353353
# Controls whether request forgergy protection is turned on or not. Turned off by default only in test mode.
354354
class_inheritable_accessor :allow_forgery_protection

0 commit comments

Comments
 (0)