As it turns out rails implements HTTP head calls for you. A fellow programmer was creating rails functional tests and using rcow noticed that we did not write test for the head command. He then found out that the functional test in rails when creating the mock response object includes the body like a normal get call. We reread the spec for http head one more time just in case we both thought incorrectly. So, I fired up the test using code komodo's ruby debugger. for the next 2 hours we stepped in the tes setup code and the rails frame work. We stepped in a lot of code until we hit the trunk/vendor/rails/actionpack/lib/action_controller/request.rb:line 16
def method
@request_method ||= (!parameters[:_ethod].blank? && @env['REQUEST_METHOD'] == 'POST') ?
parameters[:_method].to_s.downcase.to_sym :
@env['REQUEST_METHOD'].downcase.to_sym
@request_method == :head ? :get : @request_method
end
I did kept stepping in but I never found the code that takes care of the head body problem. We tested the head call using curl and it works, but the test returns the body like a normal get call.
So it must be code that is not ran for the testing frame work. Ihope to find the other code for the head call but I am having a hard time learning how to debug live rails apps.
Read up on your http head request
here it is useful for caching. We all know what caching can lead to.
Just something i thought was cool.