mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
Fix HTML error pages being returned when JSON is expected (#12713)
Fix #12509 See also #12214
This commit is contained in:
parent
ca78b1473e
commit
353c94910b
@ -136,6 +136,9 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def respond_with_error(code)
|
||||
render "errors/#{code}", layout: 'error', status: code, formats: [:html]
|
||||
respond_to do |format|
|
||||
format.any { render "errors/#{code}", layout: 'error', status: code, formats: [:html] }
|
||||
format.json { render json: { error: Rack::Utils::HTTP_STATUS_CODES[code] }, status: code }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user