Skip to content

Feature request: extract async middleware utilities from HttpResolverLocal #8133

@leandrodamascena

Description

@leandrodamascena

Use case

HttpResolverLocal contains async middleware coordination logic (threading bridge between sync middlewares and async context) that we need to reuse in the main resolvers for async support. Currently this logic is buried as private methods in HttpResolverLocal and can't be shared.

Solution/User Experience

  • Create aws_lambda_powertools/event_handler/middlewares/async_utils.py
  • Extract _wrap_middleware_async() threading coordination logic (the asyncio.Event + threading.Event bridge that allows sync middlewares to work in async context)
  • Refactor HttpResolverLocal to use the extracted utilities instead of its own private methods
  • All existing tests pass, zero behavior change

This is a refactor with no new functionality. No tests changes to make sure this won't break.

Alternative solutions

Acknowledgment

Metadata

Metadata

Projects

Status

Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions