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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
83ca41657a99b65d99889abe712ba5e2?d=identicon&s=25 Jason Roelofs (Guest)
on 2007-06-20 16: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?

Jason
Db5ce6f13445719de3d630f02d23493b?d=identicon&s=25 raskchanky@gmail.com (Guest)
on 2007-06-26 00: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.

HTH

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