Skip to content

Feature request: add async api adapter for async resolver support #8135

@leandrodamascena

Description

@leandrodamascena

Use case

_registered_api_adapter is the final middleware in the chain - it calls the actual route handler with the correct arguments. Today it's synchronous and can't await async handlers. We need an async version that detects coroutines and awaits them.

Solution/User Experience

  • Add _registered_api_adapter_async() function that:
    • Extracts route args from context (same as sync version)
    • Injects Request object if handler declares one (same as sync version)
    • Calls the handler and detects if result is a coroutine
    • If coroutine: awaits it
    • Passes result through _to_response() (sync, CPU-bound — stays sync)
  • Unit tests covering sync handler, async handler, and mixed scenarios
  • Nothing calls it in the resolve chain yet — internal building block only

Alternative solutions

Acknowledgment

Metadata

Metadata

Projects

Status

Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions