send_data always sends xml file?

I'm trying to use send_data to send a simple text file.

Every reference I can find says I can supply a MIME type with the ":type" option and that will determine the kind of file I get on the machine that downloads the file I'm sending. Instead I ALWAYS get an XML file.

here's the code snippet:

File.open(@temp_download_file_path, 'r') do |f|      send_data f.read, :type => "text/plain; charset=utf-8", :filename => "foo.txt" end

No matter what I use for ":type" (including leaving it out), I still get a file on the other end that the Mac thinks is an xml file. The file extension on the filename parameter also does not budge it off of making it an xml file.

Any suggestions?

“Mac thinks it’s an xml file.” → Does the file end up with an .xml extension in your Downloads dir? and/or when you try to open it some program registered to .xml extension opens it or what?

Which browser and what do you see in the Response headers? All browsers do the same thing?