From ed1112bcef8598f30d90dfaa382a258156d8e457 Mon Sep 17 00:00:00 2001 From: Robbendebiene Date: Fri, 23 Sep 2022 11:40:19 +0200 Subject: [PATCH] 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 --- app/controllers/api/notes_controller.rb | 1 + config/routes.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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" } -- 2.43.2