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""