MCPcopy Index your code
hub / github.com/zappa/Zappa / process_lambda_payload_v2

Function process_lambda_payload_v2

zappa/wsgi.py:151–171  ·  view source on GitHub ↗
(event_info)

Source from the content-addressed store, hash-verified

149
150
151def process_lambda_payload_v2(event_info):
152 # See the new format documentation
153 # here: https://docs.aws.amazon.com/lambda/latest/dg/urls-invocation.html#urls-payloads
154 method = event_info["requestContext"]["http"]["method"]
155 headers = event_info["headers"]
156 if event_info.get("cookies"):
157 headers["cookie"] = "; ".join(event_info["cookies"])
158 path = unquote(event_info["rawPath"])
159 query = event_info.get("queryStringParameters", {})
160 query_string = urlencode(query) if query else ""
161 # Systems calling the Lambda (other than API Gateway) may not provide the field requestContext
162 # Extract remote_user, authorizer if Authorizer is enabled
163 remote_user = None
164 authorizer = event_info["requestContext"].get("authorizer", None)
165 if authorizer:
166 if authorizer.get("lambda"):
167 # Need to add principalId manually to lambda authorizer response context
168 remote_user = authorizer["lambda"].get("principalId")
169 elif authorizer.get("iam"):
170 remote_user = authorizer["iam"].get("userArn")
171 return method, headers, path, query_string, remote_user, authorizer
172
173
174def common_log(environ, response, response_time: Optional[int] = None):

Callers 2

create_asgi_scopeFunction · 0.85
create_wsgi_requestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected