forked from openlp/openlp
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:
parent
b51829d4d6
commit
48901cecfc
@ -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
|
||||
|
||||
|
||||
@v2_views.route('/live', methods=['POST'])
|
||||
|
@ -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
|
||||
|
||||
|
||||
@v2_custom.route('/add', methods=['POST'])
|
||||
|
@ -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
|
||||
|
||||
|
||||
@v2_images.route('/add', methods=['POST'])
|
||||
|
@ -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
|
||||
|
||||
|
||||
@v2_media.route('/add', methods=['POST'])
|
||||
|
@ -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
|
||||
|
||||
|
||||
@v2_presentations.route('/add', methods=['POST'])
|
||||
|
@ -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
|
||||
|
||||
|
||||
@v2_songs.route('/add', methods=['POST'])
|
||||
|
Loading…
Reference in New Issue
Block a user