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
Use case
_registered_api_adapteris the final middleware in the chain - it calls the actual route handler with the correct arguments. Today it's synchronous and can'tawaitasync handlers. We need an async version that detects coroutines and awaits them.Solution/User Experience
_registered_api_adapter_async()function that:Requestobject if handler declares one (same as sync version)awaits it_to_response()(sync, CPU-bound — stays sync)Alternative solutions
Acknowledgment