Skip to content

Commit

Permalink
add request/response debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ioigoume committed Oct 18, 2023
1 parent a158cac commit d1c40da
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/utils/globalMethods.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def __init__(self, tag: str = "", skip: bool = False):
self.oauth = OAuth()

async def __call__(self, request: Request, response: Response):
self.logger.debug("""=============== Request Context =================""")
self.logger.debug("""Request Url: {0}""" . format(response.request.url))
self.logger.debug("""Request Body: {0}""" . format(response.request.body))

# config
authorize_file = 'authorize.' + g.tenant + '.' + g.environment + '.py'
config_file = 'config.' + g.tenant + '.' + g.environment + '.py'
Expand All @@ -42,8 +46,10 @@ async def __call__(self, request: Request, response: Response):
metadata = await rciam.load_server_metadata()

headers = {'Authorization': f'Bearer {access_token}'}
self.logger.debug("""Request Headers: {0}""" . format(headers))

resp = reqs.get(metadata['userinfo_endpoint'], headers=headers)
self.logger.debug("""User Info Endpoint Respnse: {0}""" . format(resp))
self.logger.debug("""User Info Endpoint Response: {0}""" . format(resp))

# Authentication
if resp.status_code == 401:
Expand Down

0 comments on commit d1c40da

Please sign in to comment.