Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8426

Show
Ignore:
Timestamp:
12/17/07 00:10:18 (9 months ago)
Author:
david
Message:

Allow headers[Accept] to be set by hand when calling xml_http_request (closes #10461) [BMorearty]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r8425 r8426  
    11*2.0.2* (December 16th, 2007) 
     2 
     3* Allow headers['Accept'] to be set by hand when calling xml_http_request #10461 [BMorearty] 
    24 
    35* Added OPTIONS to list of default accepted HTTP methods #10449 [holoway] 
  • trunk/actionpack/lib/action_controller/integration.rb

    r8168 r8426  
    188188        headers ||= {} 
    189189        headers['X-Requested-With'] = 'XMLHttpRequest' 
    190         headers['Accept'] = 'text/javascript, text/html, application/xml, text/xml, */*' 
     190        headers['Accept'] ||= 'text/javascript, text/html, application/xml, text/xml, */*' 
    191191 
    192192        process(request_method, path, parameters, headers) 
  • trunk/actionpack/test/controller/integration_test.rb

    r8047 r8426  
    180180    @session.xml_http_request(:head,path,params,headers) 
    181181  end 
     182   
     183  def test_xml_http_request_override_accept 
     184    path = "/index"; params = "blah"; headers = {:location => 'blah', "Accept" => "application/xml"} 
     185    headers_after_xhr = headers.merge( 
     186      "X-Requested-With" => "XMLHttpRequest" 
     187    ) 
     188    @session.expects(:process).with(:post,path,params,headers_after_xhr) 
     189    @session.xml_http_request(:post,path,params,headers) 
     190  end 
    182191end 
    183192