Mod_ruby Setting Content-Type in rhtml files

(Ben Gribaudo) #1

Howdy!

I feel like I am missing something simple here. I would like to set the HTTP content-type header from an rhtml file. I've tried different approaches with the same result--I always receive the default ("text/html ...") instead of the specified header. What am I doing wrong?

This code:
<%
require "cgi"

cgi = CGI.new
cgi.header("type"=>"text/plain")
puts "test"
%>
returns a content type header of "text/html; charset=iso-8859-1" instead of "text/plain".

Thank you,
Ben