mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
Merge #2075
2075: Allow payloads with no documents r=irevoire a=MarinPostma accept addition with 0 documents. 0 bytes payload are still refused, since they are not valid json/jsonlines/csv anyways... close #1987 Co-authored-by: mpostma <postma.marin@protonmail.com>
This commit is contained in:
commit
1be3a1e945
3 changed files with 10 additions and 29 deletions
|
@ -710,20 +710,11 @@ async fn replace_document() {
|
|||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn error_add_no_documents() {
|
||||
async fn add_no_documents() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
let (response, code) = index.add_documents(json!([]), None).await;
|
||||
|
||||
let expected_response = json!({
|
||||
"message": "The `json` payload must contain at least one document.",
|
||||
"code": "malformed_payload",
|
||||
"type": "invalid_request",
|
||||
"link": "https://docs.meilisearch.com/errors#malformed_payload"
|
||||
});
|
||||
|
||||
assert_eq!(response, expected_response);
|
||||
assert_eq!(code, 400);
|
||||
let (_response, code) = index.add_documents(json!([]), None).await;
|
||||
assert_eq!(code, 202);
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue