Skip to content

Commit

Permalink
📝 add documentation to create scope function
Browse files Browse the repository at this point in the history
  • Loading branch information
ediskandarov committed Feb 27, 2021
1 parent 2b71225 commit a5b55de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": ".venv/bin/python"
}
9 changes: 9 additions & 0 deletions mangum/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ def __call__(self, event: dict, context: "LambdaContext") -> dict:
return response

def _create_scope(self, event: dict, context: "LambdaContext") -> Scope:
"""Creates a scope object according to ASGI specification from a Lambda Event.
https://asgi.readthedocs.io/en/latest/specs/www.html#http-connection-scope
The event comes from various sources: AWS ALB, AWS API Gateway of different
versions and configurations(multivalue header, etc).
Thus, some heuristics is applied to guess an event type.
"""
request_context = event["requestContext"]

if event.get("multiValueHeaders"):
Expand Down

0 comments on commit a5b55de

Please sign in to comment.