From: Simon Brandhof Date: Thu, 22 Mar 2012 13:14:33 +0000 (+0100) Subject: Fix backward-compatibility of /api/properties X-Git-Tag: 3.0~147 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4807b56a875275c36ad1e7aaaf5f6975fe4a4a8b;p=sonarqube.git Fix backward-compatibility of /api/properties Keep status 200 when property not found --- 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])) }