INNER CODE UNIT · Python
support_global_request_object
bobbui/json-logging-python · json_logging/framework/connexion/__init__.py:133
def support_global_request_object():
return True
@staticmethod
def get_current_request():
if _AsyncApp is not None:
async_request = _current_async_request.get()
if async_request is not None:
return async_request
# The request proxy exists even outside a request; only expose it while a request is active,
# so callers fall back to json_logging.EMPTY_VALUE instead of generating fabricated IDs.
if _flask is not None and _flask.has_request_context():
return _current_request
# Connexion 3 runs error handlers and ASGI middleware outside the Flask request context. The request's
# correlation header can still be read there, but a generated ID could not be stored (connexion.g is
# flask.g), so expose the request only when it carries a correlation header.
if _connexion_scope is not None and _connexion_scope and any(
header in _current_request.headers for header in json_logging.CORRELATION_ID_HEADERS):