BUG: send_data, CONTENT TYPE not set

--> http://railsforum.com/viewtopic.php?pid=71435#p71435
bug or feature?
Thanks in advance


what environment do you have?

ruby 1.8.6-p111
rails 2.1.0
(mongrel 1.1.5 which is not relevant for the testcase)


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
         if content_type = headers.delete("Content-type")
           self.headers["type"] = content_type
         if content_type = headers.delete("content-type")
           self.headers["type"] = content_type

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


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