From 938b3fbd9e44d37dad790e180cec2fd531b8bacb Mon Sep 17 00:00:00 2001 From: Jitendra Mishra Date: Sun, 19 Feb 2023 17:29:41 +0530 Subject: [PATCH] better way to compare type --- robyn/router.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/robyn/router.py b/robyn/router.py index a2efb18a2..cde86c8fa 100644 --- a/robyn/router.py +++ b/robyn/router.py @@ -25,7 +25,7 @@ def __init__(self) -> None: def _format_response(self, res): response = {} - if type(res) == dict: + if isinstance(res, dict): status_code = res.get("status_code", 200) headers = res.get("headers", {"Content-Type": "text/plain"}) body = res.get("body", "") @@ -37,9 +37,9 @@ def _format_response(self, res): file_path = res.get("file_path") if file_path is not None: response.set_file_path(file_path) - elif type(res) == Response: + elif isinstance(res, Response): response = res - elif type(res) == bytes: + elif isinstance(res, bytes): response = Response( status_code=200, headers={"Content-Type": "application/octet-stream"},