From f231a44abe1e713f6e59f452b954b28f88db5c00 Mon Sep 17 00:00:00 2001 From: Filip H.F. "FiXato" Slagter Date: Mon, 17 Nov 2008 11:38:26 +0100 Subject: [PATCH] Added correct http header for HTTP HEAD request to ActiveResource::Connection#head. In revision 16b9a554db7e1bf3f5f224cdc5b4d27480e053ff correct http headers have been added per http method type, but the header for the HEAD request was ommitted. This caused problems with ActiveResource::Base#exists? as they do a HEAD request to check for the existence. --- activeresource/lib/active_resource/connection.rb | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/activeresource/lib/active_resource/connection.rb b/activeresource/lib/active_resource/connection.rb index 273fee3..d06a367 100644 --- a/activeresource/lib/active_resource/connection.rb +++ b/activeresource/lib/active_resource/connection.rb @@ -67,7 +67,8 @@ module ActiveResource HTTP_FORMAT_HEADER_NAMES = { :get => 'Accept', :put => 'Content-Type', :post => 'Content-Type', - :delete => 'Accept' + :delete => 'Accept', + :head => 'Content-Type', } attr_reader :site, :user, :password, :timeout @@ -137,7 +138,7 @@ module ActiveResource # Execute a HEAD request. # Used to obtain meta-information about resources, such as whether they exist and their size (via response headers). def head(path, headers = {}) - request(:head, path, build_request_headers(headers)) + request(:head, path, build_request_headers(headers, :head)) end -- 1.5.6.4