Skip to content

Commit

Permalink
fix: 500 -> 400 querystring-search with no query
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico committed Sep 23, 2023
1 parent 6b2a45a commit c9317e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/redturtle/volto/restapi/services/querystringsearch/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ def is_event_search(self, query):
"""
Check if we need to perform a custom search with p.a.events method
"""
if not query:
return False

indexes = [x["i"] for x in query]

portal_type_check = False
Expand Down
4 changes: 4 additions & 0 deletions src/redturtle/volto/tests/test_advancedsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ def test_search_by_not_handled_index_type_return_standard_order(self):
["f1", "d1", "e1"], [item["@id"].split("/")[-1] for item in result["items"]]
)

def test_search_no_query(self):
response = self.api_session.post("/@querystring-search")
self.assertEqual(response.status_code, 400)

def test_search_ignore_non_existent_indexes_and_return_custom_order_if_possible(
self,
):
Expand Down

0 comments on commit c9317e2

Please sign in to comment.