Skip to content

Commit 009712f

Browse files
committed
docs: internal request processing
1 parent 61a1247 commit 009712f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

aws_lambda_powertools/event_handler/api_gateway.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,6 +1983,36 @@ def register_resolver(func: Callable):
19831983
def resolve(self, event, context) -> Dict[str, Any]:
19841984
"""Resolves the response based on the provide event and decorator routes
19851985
1986+
## Internals
1987+
1988+
Request processing chain is triggered by a Route object being called _(`_call_route` -> `__call__`)_:
1989+
1990+
1. **When a route is matched**
1991+
1.1. Exception handlers _(if any exception bubbled up and caught)_
1992+
1.2. Global middlewares _(before, and after on the way back)_
1993+
1.3. Path level middleware _(before, and after on the way back)_
1994+
1.4. Middleware adapter to ensure Response is homogenous (_registered_api_adapter)
1995+
1.5. Run actual route
1996+
2. **When a route is NOT matched**
1997+
2.1. Exception handlers _(if any exception bubbled up and caught)_
1998+
2.2. Global middlewares _(before, and after on the way back)_
1999+
2.3. Path level middleware _(before, and after on the way back)_
2000+
2.4. Middleware adapter to ensure Response is homogenous (_registered_api_adapter)
2001+
2.5. Run 404 route handler
2002+
3. **When a route is a pre-flight CORS (often not matched)**
2003+
3.1. Exception handlers _(if any exception bubbled up and caught)_
2004+
3.2. Global middlewares _(before, and after on the way back)_
2005+
3.3. Path level middleware _(before, and after on the way back)_
2006+
3.4. Middleware adapter to ensure Response is homogenous (_registered_api_adapter)
2007+
3.5. Return 204 with appropriate CORS headers
2008+
4. **When a route is matched with Data Validation enabled**
2009+
4.1. Exception handlers _(if any exception bubbled up and caught)_
2010+
4.2. Data Validation middleware _(before, and after on the way back)_
2011+
4.3. Global middlewares _(before, and after on the way back)_
2012+
4.4. Path level middleware _(before, and after on the way back)_
2013+
4.5. Middleware adapter to ensure Response is homogenous (_registered_api_adapter)
2014+
4.6. Run actual route
2015+
19862016
Parameters
19872017
----------
19882018
event: Dict[str, Any]

0 commit comments

Comments
 (0)