From: Robbendebiene Date: Fri, 23 Sep 2022 09:40:19 +0000 (+0200) Subject: Allow setting HTTP ACCEPT header for notes API X-Git-Tag: live~1548^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/ed1112bcef8598f30d90dfaa382a258156d8e457 Allow setting HTTP ACCEPT header for notes API Previously the notes API return type could only be specified by appending the file extension like .json or .rss --- diff --git a/app/controllers/api/notes_controller.rb b/app/controllers/api/notes_controller.rb index d21a64497..c152c6272 100644 --- a/app/controllers/api/notes_controller.rb +++ b/app/controllers/api/notes_controller.rb @@ -9,6 +9,7 @@ module Api before_action :set_locale around_action :api_call_handle_error, :api_call_timeout + before_action :set_request_formats, :except => [:feed] ## # Return a list of notes in a given area diff --git a/config/routes.rb b/config/routes.rb index e45d56701..727580cb9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -84,7 +84,7 @@ OpenStreetMap::Application.routes.draw do get "gpx/:id/data" => "api/traces#data", :as => :api_trace_data # Map notes API - resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :defaults => { :format => "xml" }, :controller => "api/notes" do + resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :controller => "api/notes" do collection do get "search" get "feed", :defaults => { :format => "rss" }