index: additional logging for malformed return data

This commit is contained in:
Hay1tsme 2023-05-12 22:12:03 -04:00
parent 61e3a2c930
commit 02078080a8

View File

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