From 8d1cc65f69e1c4066d66e8c04a54cb1ab7a88b8f Mon Sep 17 00:00:00 2001 From: rachmadaniHaryono Date: Tue, 14 May 2019 04:56:25 +0800 Subject: [PATCH] fix: dev: api --- bukuserver/server.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/bukuserver/server.py b/bukuserver/server.py index 68063ef..54cb65b 100644 --- a/bukuserver/server.py +++ b/bukuserver/server.py @@ -184,14 +184,11 @@ def bookmarks(): create_bookmarks_form.tags.data, create_bookmarks_form.description.data ) - if request.path.startswith('/api/'): - res = [ - jsonify(response.response_template['success']), status.HTTP_200_OK, - {'ContentType': 'application/json'} - ] if result_flag != -1 else [ - jsonify(response.response_template['failure']), status.HTTP_400_BAD_REQUEST, - {'ContentType': 'application/json'} - ] + if request.path.startswith('/api/') and result_flag != -1: + res = jsonify(response.response_template['success']) + elif request.path.startswith('/api/') and result_flag == -1: + res = jsonify(response.response_template['failure']) + res.status_code = status.HTTP_400_BAD_REQUEST else: bm_text = '[{0}]'.format(url_data) if result_flag != -1: