Skip to content

feat: first-class CORS helper (middleware / preflight) #49

Closed

Description

@ZhuchkaTriplesix

Context

  • CORS is only documented as a manual set_middleware use case. Teams expect allow_origins / allow_methods / allow_headers in one place, plus correct preflight for OPTIONS.
  • See Feature gaps.

Direction

  • Ship a Python helper (e.g. CORSConfig + apply_cors(app, config) or a factory for set_middleware) that returns None to continue, or a short preflight/response for allowed origins.
  • Do not break existing single-middleware contract; document interaction if a user also sets set_middleware for other reasons (order / composition).

Acceptance criteria

  • Pytest: browser-like preflight and a simple cross-origin GET with Origin header receive expected CORS headers.
  • Short section in docs/handlers.md or a dedicated docs/cors.md linked from the index.

Research

  • Starlette CORSMiddleware defaults; RSGI scope / headers available on the middleware entry point already.

Activity

  1. added this to the v0.3.0 milestone on Apr 26, 2026
  2. linked a pull request that will close this issueIssue 49 cors #62on Apr 26, 2026
  3. linked a pull request that will close this issuerelease: v0.2.0 hardening from dev #69on Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions