From 45a1d298a941939d4a5e7da273d9394a16d8c5f1 Mon Sep 17 00:00:00 2001 From: mmd-osm Date: Mon, 30 Dec 2019 17:26:00 +0100 Subject: [PATCH] Move default_format_xml to api_controller --- app/controllers/api/map_controller.rb | 5 ----- app/controllers/api/nodes_controller.rb | 5 ----- app/controllers/api/old_controller.rb | 5 ----- app/controllers/api/relations_controller.rb | 5 ----- app/controllers/api/ways_controller.rb | 5 ----- app/controllers/api_controller.rb | 5 +++++ 6 files changed, 5 insertions(+), 25 deletions(-) diff --git a/app/controllers/api/map_controller.rb b/app/controllers/api/map_controller.rb index 34257fc99..4b233c995 100644 --- a/app/controllers/api/map_controller.rb +++ b/app/controllers/api/map_controller.rb @@ -7,11 +7,6 @@ module Api before_action :default_format_xml - # Set format to xml unless client requires a specific format - def default_format_xml - request.format = "xml" unless params[:format] - end - # This is probably the most common call of all. It is used for getting the # OSM data for a specified bounding box, usually for editing. First the # bounding box (bbox) is checked to make sure that it is sane. All nodes diff --git a/app/controllers/api/nodes_controller.rb b/app/controllers/api/nodes_controller.rb index 1827603a7..08f19008f 100644 --- a/app/controllers/api/nodes_controller.rb +++ b/app/controllers/api/nodes_controller.rb @@ -15,11 +15,6 @@ module Api before_action :default_format_xml - # Set format to xml unless client requires a specific format - def default_format_xml - request.format = "xml" unless params[:format] - end - # Create a node from XML. def create assert_method :put diff --git a/app/controllers/api/old_controller.rb b/app/controllers/api/old_controller.rb index 92c6d9295..b68fde6b5 100644 --- a/app/controllers/api/old_controller.rb +++ b/app/controllers/api/old_controller.rb @@ -18,11 +18,6 @@ module Api before_action :default_format_xml - # Set format to xml unless client requires a specific format - def default_format_xml - request.format = "xml" unless params[:format] - end - def history # the .where() method used in the lookup_old_element_versions # call won't throw an error if no records are found, so we have diff --git a/app/controllers/api/relations_controller.rb b/app/controllers/api/relations_controller.rb index c33840978..566efe0eb 100644 --- a/app/controllers/api/relations_controller.rb +++ b/app/controllers/api/relations_controller.rb @@ -13,11 +13,6 @@ module Api before_action :default_format_xml - # Set format to xml unless client requires a specific format - def default_format_xml - request.format = "xml" unless params[:format] - end - def create assert_method :put diff --git a/app/controllers/api/ways_controller.rb b/app/controllers/api/ways_controller.rb index a721f82f7..95f36df53 100644 --- a/app/controllers/api/ways_controller.rb +++ b/app/controllers/api/ways_controller.rb @@ -13,11 +13,6 @@ module Api before_action :default_format_xml - # Set format to xml unless client requires a specific format - def default_format_xml - request.format = "xml" unless params[:format] - end - def create assert_method :put diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 44efdc071..ca09e5807 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -3,6 +3,11 @@ class ApiController < ApplicationController private + # Set format to xml unless client requires a specific format + def default_format_xml + request.format = "xml" unless params[:format] + 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 -- 2.43.2