diff options
author | ogeidix <diegogiorgini@gmail.com> | 2011-07-19 22:05:16 +0200 |
---|---|---|
committer | ogeidix <diegogiorgini@gmail.com> | 2011-07-19 22:05:16 +0200 |
commit | 1ac802fe3c79fc2838253e71e4f32e3f1710f8f1 (patch) | |
tree | ff5076f4ee19716cb60af92342482801ed083f9b /actionpack/test/dispatch | |
parent | 37418e546834a034d1ad923f3f46f9b14f87d7a6 (diff) | |
download | rails-1ac802fe3c79fc2838253e71e4f32e3f1710f8f1.tar.gz rails-1ac802fe3c79fc2838253e71e4f32e3f1710f8f1.tar.bz2 rails-1ac802fe3c79fc2838253e71e4f32e3f1710f8f1.zip |
Check Accept and Content-Type headers before evaluating them in xhr requests. Closes #2119
An xhr request must have an "Accept" or "Content-type" header in order to be considered a request with valid_accept_header.
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/request_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 25b1b4f745..060bcfb5ec 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -468,6 +468,12 @@ class RequestTest < ActiveSupport::TestCase assert request.formats.empty? end + test "formats with xhr request" do + request = stub_request 'HTTP_X_REQUESTED_WITH' => "XMLHttpRequest" + request.expects(:parameters).at_least_once.returns({}) + assert_equal [Mime::JS], request.formats + end + test "ignore_accept_header" do ActionDispatch::Request.ignore_accept_header = true |