Skip to content

Commit

Permalink
add support api gateway context
Browse files Browse the repository at this point in the history
  • Loading branch information
langovoi committed Dec 3, 2023
1 parent b39df70 commit 08f5095
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion krddevdays/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os
import base64
import json

import dotenv
from django.core.wsgi import get_wsgi_application
Expand All @@ -11,7 +13,8 @@


def application(environ, start_response):
script_name = environ.get('HTTP_X_SCRIPT_NAME', '')
api_gateway_context = json.loads(base64.b64decode(environ.get('HTTP_X-YC_APIGATEWAY_OPERATION_CONTEXT', 'e30=')).decode('utf8').replace("'", '"'))
script_name = environ.get('HTTP_X_SCRIPT_NAME', api_gateway_context['X-Script-Name'] or '')
if script_name:
environ['SCRIPT_NAME'] = script_name
path_info = environ['PATH_INFO']
Expand Down

0 comments on commit 08f5095

Please sign in to comment.