diff options
author | Ryan Bigg <radarlistener@gmail.com> | 2008-10-01 21:38:16 +0930 |
---|---|---|
committer | Ryan Bigg <radarlistener@gmail.com> | 2008-10-01 21:38:16 +0930 |
commit | dbbd757edd896947e33fdf18ba870b8df5974d62 (patch) | |
tree | cc0428bee430a18200925acb830f3dc3946e31de /activeresource | |
parent | 6aca4458e3a1712a4a675ee7bf2cd35701ff75c9 (diff) | |
parent | 8292c7dfce4b893588860053e50ef60ae9a0609a (diff) | |
download | rails-dbbd757edd896947e33fdf18ba870b8df5974d62.tar.gz rails-dbbd757edd896947e33fdf18ba870b8df5974d62.tar.bz2 rails-dbbd757edd896947e33fdf18ba870b8df5974d62.zip |
Merge branch 'master' of git@github.com:lifo/docrails
Diffstat (limited to 'activeresource')
-rw-r--r-- | activeresource/lib/active_resource/connection.rb | 2 | ||||
-rw-r--r-- | activeresource/test/connection_test.rb | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/activeresource/lib/active_resource/connection.rb b/activeresource/lib/active_resource/connection.rb index fe9c2d57fe..273fee3286 100644 --- a/activeresource/lib/active_resource/connection.rb +++ b/activeresource/lib/active_resource/connection.rb @@ -199,7 +199,7 @@ module ActiveResource # Builds headers for request to remote service. def build_request_headers(headers, http_method=nil) - authorization_header.update(default_header).update(headers).update(http_format_header(http_method)) + authorization_header.update(default_header).update(http_format_header(http_method)).update(headers) end # Sets authorization header diff --git a/activeresource/test/connection_test.rb b/activeresource/test/connection_test.rb index 06f31f1b57..84bcf69219 100644 --- a/activeresource/test/connection_test.rb +++ b/activeresource/test/connection_test.rb @@ -168,12 +168,20 @@ class ConnectionTest < Test::Unit::TestCase assert_equal 200, response.code end - uses_mocha('test_timeout') do + uses_mocha('test_timeout, test_accept_http_header') do def test_timeout @http = mock('new Net::HTTP') @conn.expects(:http).returns(@http) @http.expects(:get).raises(Timeout::Error, 'execution expired') - assert_raises(ActiveResource::TimeoutError) { @conn.get('/people_timeout.xml') } + assert_raise(ActiveResource::TimeoutError) { @conn.get('/people_timeout.xml') } + end + + def test_accept_http_header + @http = mock('new Net::HTTP') + @conn.expects(:http).returns(@http) + path = '/people/1.xml' + @http.expects(:get).with(path, {'Accept' => 'application/xhtml+xml'}).returns(ActiveResource::Response.new(@matz, 200, {'Content-Type' => 'text/xhtml'})) + assert_nothing_raised(Mocha::ExpectationError) { @conn.get(path, {'Accept' => 'application/xhtml+xml'}) } end end |