]> git.openstreetmap.org Git - rails.git/commitdiff
Allow setting HTTP ACCEPT header for notes API
authorRobbendebiene <robbendebiene@mailbox.org>
Fri, 23 Sep 2022 09:40:19 +0000 (11:40 +0200)
committerRobbendebiene <robbendebiene@mailbox.org>
Fri, 23 Sep 2022 09:40:19 +0000 (11:40 +0200)
Previously the notes API return type could only be specified by appending the file extension like .json or .rss

app/controllers/api/notes_controller.rb
config/routes.rb

index d21a6449781e8779009e7bedb7be71159a887630..c152c6272266a352c9d2f1d5b5dbfcf6b2d81263 100644 (file)
@@ -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
index e45d56701ef6dde5c99abc131d0872371acf250b..727580cb99ebcfca0a74cf70b6f58578dccf4af6 100644 (file)
@@ -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" }