middleware and respnse models updated

This commit is contained in:
2025-01-27 17:25:49 +03:00
parent e403993d24
commit b88f910a43
54 changed files with 1125 additions and 808 deletions

View File

@@ -92,11 +92,12 @@ class MiddlewareModule:
auth_context = AuthContext(
auth={"token": {"access_token": "", "refresher_token": "", "context": {}}},
url=endpoint_url,
request=request,
)
# Set auth context on the wrapper function itself
setattr(func, 'auth_context', auth_context)
setattr(wrapper, 'auth_context', auth_context)
setattr(func, "auth_context", auth_context)
setattr(wrapper, "auth_context", auth_context)
# Call the original endpoint function
if inspect.iscoroutinefunction(func):
@@ -105,10 +106,11 @@ class MiddlewareModule:
result = func(request, *args, **kwargs)
# Set auth context on the wrapper function itself
setattr(func, 'auth_context', auth_context)
setattr(wrapper, 'auth_context', auth_context)
setattr(func, "auth_context", auth_context)
setattr(wrapper, "auth_context", auth_context)
return result
return wrapper