Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"scheme": headers.get("X-Forwarded-Proto", "https"),
"query_string": query_string,
"server": server,
"client": client,
"asgi": {"version": "3.0"},
"aws": {"event": event, "context": context},
}
is_binary = event.get("isBase64Encoded", False)
body = event["body"] or b""
if is_binary:
body = base64.b64decode(body)
elif not isinstance(body, bytes):
body = body.encode()
asgi_cycle = ASGIHTTPCycle(scope, is_binary=is_binary, logger=self.logger)
asgi_cycle.put_message(
{"type": "http.request", "body": body, "more_body": False}
)
response = asgi_cycle(self.app)
return response