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

Fixes #19115
main
Claire 2 years ago committed by GitHub
parent af46584f82
commit 2750a7a0e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/controllers/api/base_controller.rb

@ -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

Loading…
Cancel
Save