From 1bb4ad9262efde3b7aefddf849480a102763a68f Mon Sep 17 00:00:00 2001 From: Jasper Maes Date: Wed, 28 Nov 2018 19:08:21 +0100 Subject: Fix deprecation: render :text is deprecated because it does not actually render a text/plain response --- app/controllers/chaos_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'app/controllers/chaos_controller.rb') diff --git a/app/controllers/chaos_controller.rb b/app/controllers/chaos_controller.rb index b4f46cddbe9..8d518c14b90 100644 --- a/app/controllers/chaos_controller.rb +++ b/app/controllers/chaos_controller.rb @@ -15,7 +15,7 @@ class ChaosController < ActionController::Base duration_taken = (Time.now - start).seconds Kernel.sleep duration_s - duration_taken if duration_s > duration_taken - render text: "OK", content_type: 'text/plain' + render plain: "OK" end def cpuspin @@ -24,14 +24,14 @@ class ChaosController < ActionController::Base rand while Time.now < end_time - render text: "OK", content_type: 'text/plain' + render plain: "OK" end def sleep duration_s = (params[:duration_s]&.to_i || 30).seconds Kernel.sleep duration_s - render text: "OK", content_type: 'text/plain' + render plain: "OK" end def kill @@ -44,13 +44,13 @@ class ChaosController < ActionController::Base secret = ENV['GITLAB_CHAOS_SECRET'] # GITLAB_CHAOS_SECRET is required unless you're running in Development mode if !secret && !Rails.env.development? - render text: "chaos misconfigured: please configure GITLAB_CHAOS_SECRET when using GITLAB_ENABLE_CHAOS_ENDPOINTS outside of a development environment", content_type: 'text/plain', status: 500 + render plain: "chaos misconfigured: please configure GITLAB_CHAOS_SECRET when using GITLAB_ENABLE_CHAOS_ENDPOINTS outside of a development environment", status: :internal_server_error end return unless secret unless request.headers["HTTP_X_CHAOS_SECRET"] == secret - render text: "To experience chaos, please set X-Chaos-Secret header", content_type: 'text/plain', status: 401 + render plain: "To experience chaos, please set X-Chaos-Secret header", status: :unauthorized end end end -- cgit v1.2.3