Skip to content

Commit e5fd493

Browse files
authored
Merge branch 'main' into bump-meilisearch-v0.30.0
2 parents 9b53230 + fea4d13 commit e5fd493

File tree

3 files changed

+51
-105
lines changed

3 files changed

+51
-105
lines changed

Pipfile.lock

Lines changed: 40 additions & 104 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

meilisearch/_httprequests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def send_request(
4545
request_path,
4646
timeout=self.config.timeout,
4747
headers=self.headers,
48-
data=json.dumps(body) if body else "null",
48+
data=json.dumps(body) if body else "" if body == "" else "null",
4949
)
5050
return self.__validate(request)
5151

tests/index/test_index_document_meilisearch.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ def test_add_documents(empty_index, small_movies):
2626
assert update.status == "succeeded"
2727

2828

29+
def test_add_documents_empty(empty_index):
30+
"""Tests adding empty string as documents to a clean index."""
31+
index = empty_index()
32+
with pytest.raises(Exception) as e_info:
33+
index.add_documents("")
34+
assert e_info.value.code == "missing_payload"
35+
assert e_info.value.type == "invalid_request"
36+
assert e_info.value.link == "https://docs.meilisearch.com/errors#missing_payload"
37+
38+
2939
@pytest.mark.parametrize("batch_size", [2, 3, 1000])
3040
@pytest.mark.parametrize(
3141
"primary_key, expected_primary_key",

0 commit comments

Comments
 (0)