]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api_controller.rb
JSON output, handle Accept header
[rails.git] / app / controllers / api_controller.rb
index 44efdc0711f2cb39d53e8b59d33d58e8583dca5b..7599568af225e2d35e1f16cd3fa58e531353cb6d 100644 (file)
@@ -3,6 +3,13 @@ class ApiController < ApplicationController
 
   private
 
+  # Set format to xml unless client requires a specific format
+  def default_format_xml
+    unless params[:format]
+      request.format = "xml" unless request.format.symbol == :json
+    end
+  end
+
   def authorize(realm = "Web Password", errormessage = "Couldn't authenticate you")
     # make the current_user object from any auth sources we have
     setup_user_auth