FOUR-20933: Implement ETag Caching for Screens Data by eiresendez · Pull Request #7771 · ProcessMaker/processmaker
added 5 commits
November 26, 2024 14:09- Introduced IfNoneMatch middleware to handle ETag-based caching: - Supports safe HTTP methods (GET, HEAD). - Returns "304 Not Modified" for matching ETags. - Handles multiple ETags and restores original request methods. - Added EtagManager for flexible ETag generation: - Default ETag generation uses MD5 hash. - Supports custom hash algorithms like SHA-256 via callbacks. - Included test cases: - Validate default ETag generation. - Test custom callback logic for ETag creation. This commit adds foundational support for ETag-based caching in the application.
…ware - Merged `etag.set` and `etag.if-none-match` middlewares into a single `etag.handle` middleware. - Simplified logic to reduce redundancy and improve maintainability. - Ensured ETag validation (`If-None-Match`) and generation are handled in the same flow. - Preserved compatibility with HEAD requests for consistency. This refactor improves clarity, reduces potential misconfigurations, and keeps the ETag logic centralized.
…d tests - Created tests for the new `HandleEtag` middleware: - Validates ETag generation and correctness. - Tests responses for both matching and non-matching `If-None-Match` headers. - Ensures proper handling of weak ETags (`W/`). - Removed old tests for `SetEtag` and `IfNoneMatch` middlewares as they are no longer needed. This commit improves test clarity and ensures the new ETag middleware behaves as expected.
- Added a test to validate ETag generation for user-specific routes using `etag:user`. - Simulates an authenticated user and verifies the ETag includes the user ID. These tests ensure the ETag middleware behaves correctly for both user-specific and common routes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters