diff --git a/lib/api/root_api.rb b/lib/api/root_api.rb index 60ed908f7927..7d11031b367e 100644 --- a/lib/api/root_api.rb +++ b/lib/api/root_api.rb @@ -90,6 +90,12 @@ def allowed_content_types %w(application/json application/hal+json) end + # Prevent committing the session + # This prevents an unnecessary write when accessing the API + def skip_session_write + request.session_options[:skip] = true + end + def enforce_content_type # Content-Type is not present in GET or DELETE requests return if request.get? || request.delete? @@ -325,6 +331,7 @@ def self.authentication_scope(sym) # run authentication before each request after_validation do + skip_session_write authenticate set_localization enforce_content_type