always return a list when searching in the api

It is not a error when no search results are returned, it is to be expected. The api should return a empty list to show that there were no results (status code 200 OK) rather than a 400 (BAD REQUEST).
This commit is contained in:
Daniel 2020-03-11 13:22:37 +13:00
parent b51829d4d6
commit 48901cecfc
6 changed files with 6 additions and 18 deletions

View File

@ -61,9 +61,7 @@ def add(id):
def search_bible():
text = request.args.get('text', '')
result = search(text)
if result:
return jsonify(result)
return '', 400
return jsonify(result)
@v2_views.route('/live', methods=['POST'])

View File

@ -61,9 +61,7 @@ def add(id):
def search_view():
text = request.args.get('text', '')
result = search(text)
if result:
return jsonify(result)
return '', 400
return jsonify(result)
@v2_custom.route('/add', methods=['POST'])

View File

@ -61,9 +61,7 @@ def add(id):
def search_view():
text = request.args.get('text', '')
result = search(text)
if result:
return jsonify(result)
return '', 400
return jsonify(result)
@v2_images.route('/add', methods=['POST'])

View File

@ -61,9 +61,7 @@ def add(id):
def search_view():
text = request.args.get('text', '')
result = search(text)
if result:
return jsonify(result)
return '', 400
return jsonify(result)
@v2_media.route('/add', methods=['POST'])

View File

@ -61,9 +61,7 @@ def add(id):
def search_view():
text = request.args.get('text', '')
result = search(text)
if result:
return jsonify(result)
return '', 400
return jsonify(result)
@v2_presentations.route('/add', methods=['POST'])

View File

@ -61,9 +61,7 @@ def add(id):
def search_view():
text = request.args.get('text', '')
result = search(text)
if result:
return jsonify(result)
return '', 400
return jsonify(result)
@v2_songs.route('/add', methods=['POST'])