diff options
author | rpereira2 <rpereira@gitlab.com> | 2019-04-03 12:31:44 +0300 |
---|---|---|
committer | rpereira2 <rpereira@gitlab.com> | 2019-04-04 23:42:33 +0300 |
commit | 16772b91f0b71b47c8e72bfa2d11693aed58e3ba (patch) | |
tree | cc265041450ea927627b3c345c572c441a050bae /app | |
parent | eac3e2302c4155ed1890e39b7124672d79b795b6 (diff) |
Remove permitting of params
- It is now being done in ProxyService class.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/environments/prometheus_api_controller.rb | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/app/controllers/projects/environments/prometheus_api_controller.rb b/app/controllers/projects/environments/prometheus_api_controller.rb index bbd937981bb..0ce97706792 100644 --- a/app/controllers/projects/environments/prometheus_api_controller.rb +++ b/app/controllers/projects/environments/prometheus_api_controller.rb @@ -5,13 +5,11 @@ class Projects::Environments::PrometheusApiController < Projects::ApplicationCon before_action :environment def proxy - permitted = permit_params - result = Prometheus::ProxyService.new( environment, request.method, - permitted[:proxy_path], - permitted.except(:proxy_path) # rubocop: disable CodeReuse/ActiveRecord + params[:proxy_path], + params ).execute if result.nil? @@ -24,20 +22,15 @@ class Projects::Environments::PrometheusApiController < Projects::ApplicationCon if result[:status] == :success render status: result[:http_status], json: result[:body] else - render status: result[:http_status] || :bad_request, + render( + status: result[:http_status] || :bad_request, json: { status: result[:status], message: result[:message] } + ) end end private - def permit_params - params.permit([ - :proxy_path, :query, :time, :timeout, :start, :end, :step, { match: [] }, - :match_target, :metric, :limit - ]) - end - def environment @environment ||= project.environments.find(params[:id]) end |