Skip to content

Commit

Permalink
Make the xml_http_request testing method set the HTTP_ACCEPT header
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3867 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jamis committed Mar 14, 2006
1 parent 4965a75 commit 953d7c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN* *SVN*


* Make the xml_http_request testing method set the HTTP_ACCEPT header [Jamis Buck]

* Add Verification to scaffolds. Prevent destructive actions using GET [Michael Koziarski] * Add Verification to scaffolds. Prevent destructive actions using GET [Michael Koziarski]


* Avoid hitting the filesystem when using layouts by using a File.directory? cache. [Stefan Kaes, Nicholas Seckar] * Avoid hitting the filesystem when using layouts by using a File.directory? cache. [Stefan Kaes, Nicholas Seckar]
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/test_process.rb
Expand Up @@ -317,8 +317,10 @@ def process(action, parameters = nil, session = nil, flash = nil)


def xml_http_request(request_method, action, parameters = nil, session = nil, flash = nil) def xml_http_request(request_method, action, parameters = nil, session = nil, flash = nil)
@request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' @request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
@request.env['HTTP_ACCEPT'] = 'text/javascript, text/html, application/xml, text/xml, */*'
returning self.send(request_method, action, parameters, session, flash) do returning self.send(request_method, action, parameters, session, flash) do
@request.env.delete 'HTTP_X_REQUESTED_WITH' @request.env.delete 'HTTP_X_REQUESTED_WITH'
@request.env.delete 'HTTP_ACCEPT'
end end
end end
alias xhr :xml_http_request alias xhr :xml_http_request
Expand Down

0 comments on commit 953d7c9

Please sign in to comment.