diff --git a/demo/utils/checker.py b/demo/utils/checker.py index 474e417..65c7a47 100644 --- a/demo/utils/checker.py +++ b/demo/utils/checker.py @@ -5,15 +5,22 @@ from flask import Request, abort from demo.httpsig import HttpSignature, SignedData from demo.actor import fetch_actor from app import logger +from pprint import pformat def inbox_prechecker( request: Request, ) -> bool: """Inbox request prechecker""" + try: + json_payload = request.json + except json.JSONDecodeError: + abort(401, "no activity+json request!") + headers = request.headers payload = request.data - logger.debug(f"new request {payload=}\n{headers=}") + logger.info(f"new request \n{pformat(json_payload)}\n{pformat({k: v for k, v in request.headers})}") + try: parsed_signature = HttpSignature.parse_signature( headers["signature"]