Skip to content

v1.7.9: Add comprehensive CORS preflight handling and module middleware support

Choose a tag to compare

@M-Chris M-Chris released this 30 Dec 20:26
· 131 commits to main since this release

CORS Improvements:

  • Add automatic OPTIONS preflight handling with 204 response
  • Implement dynamic origin validation with sync/async function support
  • Add origin rejection with 403 status for failed validation
  • Support string, array, boolean, and function origin types
  • Add preflightContinue option for manual preflight handling
  • Add comprehensive CORS tests (26 tests, all passing)

Module Middleware:

  • Add module-level middleware (applied to all routes in module)
  • Add route-level middleware (applied to specific routes)
  • Support middleware as string names or functions
  • Add middleware resolution from MiddlewareManager and builtInMiddleware
  • Implement proper execution order: global → module → route → handler
  • Add safe middleware getter to MiddlewareManager
  • Add comprehensive module middleware tests (12 tests, all passing)

Documentation:

  • Update MIDDLEWARE_GUIDE.md with CORS dynamic origin examples
  • Update API.md with CORS function examples
  • Update CONFIGURATION_REFERENCE.md with CORS options
  • Update MODULES_GUIDE.md with complete middleware section
  • Add execution order and built-in middleware reference

Breaking Changes: None
All 604 tests passing
Backward compatible