Friday, July 20, 2007

HTTP header content type

One thing I ran into problems with when testing was that Mongrel was returning a HTTP content type of application/xml rather than text/xml. After a little searching online, I found an easy (and pretty darn useful) fix. In the 'environment.rb' file in the config folder is a section for defining MIME types that returned through the rails 'respond_to' method. I simply added this line of code and got the result I was looking for:

Mime::Type.register "text/xml", :xml

Hope this helps!

No comments: