From 4807b56a875275c36ad1e7aaaf5f6975fe4a4a8b Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 22 Mar 2012 14:14:33 +0100 Subject: [PATCH] Fix backward-compatibility of /api/properties Keep status 200 when property not found --- .../app/controllers/api/properties_controller.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/properties_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/properties_controller.rb index cb5586a9524..916340b184b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/properties_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/properties_controller.rb @@ -46,7 +46,15 @@ class Api::PropertiesController < Api::ApiController else prop = Property.by_key(key) end - not_found('property not found') unless prop + unless prop + # for backward-compatibility with versions <= 2.14 : keep status 200 + message = "Property not found: #{key}" + return respond_to do |format| + format.json { render :json => error_to_json(404, message), :status => 200 } + format.xml { render :xml => error_to_xml(404, message), :status => 200 } + format.text { render :text => message, :status => 200 } + end + end access_denied unless viewable?(key) respond_to do |format| format.json { render :json => jsonp(to_json([prop])) } -- 2.39.5