mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:21:18 +08:00
FIX: return 400 for missing required params (#6546)
If a required param is missing return a 400 and show a message displaying which param was missing. Added this to the application controller so that we don't have to add this logic to every controller action.
This commit is contained in:
@ -219,6 +219,10 @@ class ApplicationController < ActionController::Base
|
||||
render_json_error I18n.t('read_only_mode_enabled'), type: :read_only, status: 503
|
||||
end
|
||||
|
||||
rescue_from ActionController::ParameterMissing do |e|
|
||||
render_json_error e.message, status: 400
|
||||
end
|
||||
|
||||
def redirect_with_client_support(url, options)
|
||||
if request.xhr?
|
||||
response.headers['Discourse-Xhr-Redirect'] = 'true'
|
||||
|
Reference in New Issue
Block a user