[kimi] refactor: extract helpers from CSRFMiddleware.dispatch (#628) #691
Reference in New Issue
Block a user
Delete Branch "kimi/issue-628"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #628
Changes
_handle_safe_method()— handles GET/HEAD/OPTIONS/TRACE requests and sets CSRF cookie if missing_handle_unsafe_method()— validates CSRF token, checks path/endpoint exemptions, or returns 403dispatch()is now a thin router (~15 lines) that delegates to the two helpersswarmandswarm.event_logstubs totests/conftest.pyto fix pre-existingModuleNotFoundErrorthat was blocking the entire test suite (256 errors)All 2145 unit tests pass. No behavior changes.