Forum: Ruby on Rails Force Content-Type 'text/xml'

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jason R. (Guest)
on 2007-06-20 18:39
(Received via mailing list)
This is driving me crazy. How do I force Content-Type to "text/xml"? It
doesn't matter what I've tried, I still get "application/xml".

I've tried:

headers["Content-Type"] = "text/xml"
response.headers["Content-Type"] = "text/xml"

I'm rendering a builder file through:

render :template => "controller/file" # file is of course file.builder

I've even jumped down into Rails and gotten rid of every instance of
"application/xml" I could find (incidentally, only in mime_types.rb),
and it
STILL gives me that type.

What am I missing?

on 2007-06-26 02:04
(Received via mailing list)
I've had luck with the following:

render :text => xml_variable_here, :content_type => "text/xml"

I've never tried it with render :template though.


- josh
This topic is locked and can not be replied to.