File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ class ApplicationController < ActionController::Base
68
68
before_action :check_write_permissions! , if : :enforce_write_scope?
69
69
before_action :hashify_params
70
70
before_action :null_coalesce_body
71
+ before_action :reject_non_json_formats
71
72
72
73
rescue_from CloudController ::Blobstore ::BlobstoreError , with : :handle_blobstore_error
73
74
rescue_from CloudController ::Errors ::NotAuthenticated , with : :handle_not_authenticated
@@ -211,6 +212,10 @@ def null_coalesce_body
211
212
hashed_params [ :body ] ||= { }
212
213
end
213
214
215
+ def reject_non_json_formats
216
+ unprocessable! ( 'Unsupported format' ) if hashed_params . include? ( :format ) && hashed_params [ :format ] != 'json'
217
+ end
218
+
214
219
def membership
215
220
@membership ||= Membership . new ( current_user )
216
221
end
You can’t perform that action at this time.
0 commit comments