Fix REST API sometimes returning HTML on error (#19135)

Fixes #19115
This commit is contained in:
Claire 2022-09-08 09:44:36 +02:00 committed by GitHub
parent 51289c8472
commit 534077cea2

View file

@ -131,4 +131,10 @@ class Api::BaseController < ApplicationController
def disallow_unauthenticated_api_access?
authorized_fetch_mode?
end
private
def respond_with_error(code)
render json: { error: Rack::Utils::HTTP_STATUS_CODES[code] }, status: code
end
end