--> http://railsforum.com/viewtopic.php?pid=71435#p71435 bug or feature? Thanks in advance Clemens
worksforme
what environment do you have?
Mine: win32 ruby 1.8.6-p111 rails 2.1.0 (mongrel 1.1.5 which is not relevant for the testcase)
worksforme
I had a look - when actually running through the browser, a Content-
Type header is sent out as you would expect, but inside functional
tests it does look a bit odd.
The interesting method in response.rb is
def convert_content_type! if content_type = headers.delete("Content-Type") self.headers["type"] = content_type end if content_type = headers.delete("Content-type") self.headers["type"] = content_type end if content_type = headers.delete("content-type") self.headers["type"] = content_type end end
Ruby's cgi library in turn will convert a type entry into a Content-
Type one (you can see this in cgi.rb, in the header method)
Don't know why it does this (i've always thought of cgi.rb as rather
crufty)
Fred
Hence Response>>convert_content_type! must have changed/entered btw rails 1.1.6 and 2.1.0
What I was trying to explain was that it doesn't matter - cgi.rb converts the type option to a Content-Type one when it writes the header
Inside a test of course you don't go via cgi and so you see the difference you noted. You can isolate yourself from that difference by going via @response.content_type
Fred