Skip to content

feat(server): asgi_middleware accepts Callable[[ASGIApp], ASGIApp] factories #415

@bokelley

Description

@bokelley

Context

The current asgi_middleware: Sequence[tuple[type, dict[str, Any]]] parameter is loose-typed and forces adopters to wrap functional middleware in a class just to fit the tuple shape.

Accept callable factories alongside the tuple form. Branch on isinstance(entry, tuple) in _apply_asgi_middleware.

Acceptance Criteria

  • asgi_middleware accepts both tuple[type, dict] (current) and Callable[[ASGIApp], ASGIApp] factories
  • _apply_asgi_middleware branches on isinstance(entry, tuple)
  • Tests cover both shapes
  • Type signature updated to reflect the union

Files

  • src/adcp/server/ (_apply_asgi_middleware)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions