From 02078080a841d981eb30169e0a2fc8694b4169a8 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Fri, 12 May 2023 22:12:03 -0400 Subject: [PATCH] index: additional logging for malformed return data --- index.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.py b/index.py index 6992ebb..c75486d 100644 --- a/index.py +++ b/index.py @@ -160,9 +160,16 @@ class HttpDispatcher(resource.Resource): if type(ret) == str: return ret.encode() - elif type(ret) == bytes: + + elif type(ret) == bytes or type(ret) == tuple: # allow for bytes or tuple (data, response code) responses return ret + + elif ret is None: + self.logger.warn(f"None returned by controller for {request.uri.decode()} endpoint") + return b"" + else: + self.logger.warn(f"Unknown data type returned by controller for {request.uri.decode()} endpoint") return b""