diff --git a/template/python3-http-debian/index.py b/template/python3-http-debian/index.py index 2e2ec70..74340ba 100644 --- a/template/python3-http-debian/index.py +++ b/template/python3-http-debian/index.py @@ -57,14 +57,17 @@ def get_content_type(res): def format_response(res): if res == None: return ('', 200) + + if type(resp) is dict: + statusCode = format_status_code(res) + content_type = get_content_type(res) + body = format_body(res, content_type) - statusCode = format_status_code(res) - content_type = get_content_type(res) - body = format_body(res, content_type) + headers = format_headers(res) - headers = format_headers(res) + return (body, statusCode, headers) - return (body, statusCode, headers) + return res @app.route('/', defaults={'path': ''}, methods=['GET', 'PUT', 'POST', 'PATCH', 'DELETE']) @app.route('/', methods=['GET', 'PUT', 'POST', 'PATCH', 'DELETE']) diff --git a/template/python3-http/index.py b/template/python3-http/index.py index 5d2f33b..ac82b90 100644 --- a/template/python3-http/index.py +++ b/template/python3-http/index.py @@ -48,12 +48,15 @@ def format_headers(resp): def format_response(resp): if resp == None: return ('', 200) + + if type(resp) is dict: + statusCode = format_status_code(resp) + body = format_body(resp) + headers = format_headers(resp) - statusCode = format_status_code(resp) - body = format_body(resp) - headers = format_headers(resp) + return (body, statusCode, headers) - return (body, statusCode, headers) + return resp @app.route('/', defaults={'path': ''}, methods=['GET', 'PUT', 'POST', 'PATCH', 'DELETE']) @app.route('/', methods=['GET', 'PUT', 'POST', 'PATCH', 'DELETE'])