File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ class ApplicationController < ActionController::Base
6868 before_action :check_write_permissions! , if : :enforce_write_scope?
6969 before_action :hashify_params
7070 before_action :null_coalesce_body
71+ before_action :reject_non_json_formats
7172
7273 rescue_from CloudController ::Blobstore ::BlobstoreError , with : :handle_blobstore_error
7374 rescue_from CloudController ::Errors ::NotAuthenticated , with : :handle_not_authenticated
@@ -211,6 +212,10 @@ def null_coalesce_body
211212 hashed_params [ :body ] ||= { }
212213 end
213214
215+ def reject_non_json_formats
216+ unprocessable! ( 'Unsupported format' ) if hashed_params . include? ( :format ) && hashed_params [ :format ] != 'json'
217+ end
218+
214219 def membership
215220 @membership ||= Membership . new ( current_user )
216221 end
You can’t perform that action at this time.
0 commit comments