diff --git a/meilisearch-http/src/routes/document.rs b/meilisearch-http/src/routes/document.rs index 4824ec7b8..abea85ed6 100644 --- a/meilisearch-http/src/routes/document.rs +++ b/meilisearch-http/src/routes/document.rs @@ -44,14 +44,15 @@ pub fn services(cfg: &mut web::ServiceConfig) { .route(web::put().guard(guard_json).to(update_documents)) .route(web::delete().to(clear_all_documents)), ) + // this route needs to be before the /documents/{document_id} to match properly + .route( + "/indexes/{index_uid}/documents/delete-batch", + web::post().to(delete_documents), + ) .service( - web::scope("/indexes/{index_uid}/documents/") - .service( - web::resource("{document_id}") - .route(web::get().to(get_document)) - .route(web::delete().to(delete_document)), - ) - .route("/delete-batch", web::post().to(delete_documents)), + web::resource("/indexes/{index_uid}/documents/{document_id}") + .route(web::get().to(get_document)) + .route(web::delete().to(delete_document)), ); } diff --git a/meilisearch-http/src/routes/health.rs b/meilisearch-http/src/routes/health.rs index 172298861..3c7200200 100644 --- a/meilisearch-http/src/routes/health.rs +++ b/meilisearch-http/src/routes/health.rs @@ -3,7 +3,7 @@ use actix_web::{web, HttpResponse}; use crate::error::ResponseError; pub fn services(cfg: &mut web::ServiceConfig) { - cfg.route("/healts", web::get().to(get_health)); + cfg.route("/health", web::get().to(get_health)); } async fn get_health() -> Result { diff --git a/meilisearch-http/tests/documents/delete_documents.rs b/meilisearch-http/tests/documents/delete_documents.rs index d5794e40c..eb6fa040b 100644 --- a/meilisearch-http/tests/documents/delete_documents.rs +++ b/meilisearch-http/tests/documents/delete_documents.rs @@ -14,8 +14,8 @@ async fn delete_one_unexisting_document() { let server = Server::new().await; let index = server.index("test"); index.create(None).await; - let (_response, code) = index.delete_document(0).await; - assert_eq!(code, 202); + let (response, code) = index.delete_document(0).await; + assert_eq!(code, 202, "{}", response); let update = index.wait_update_id(0).await; assert_eq!(update["status"], "processed"); } @@ -85,8 +85,8 @@ async fn clear_all_documents_empty_index() { #[actix_rt::test] async fn delete_batch_unexisting_index() { let server = Server::new().await; - let (_response, code) = server.index("test").delete_batch(vec![]).await; - assert_eq!(code, 404); + let (response, code) = server.index("test").delete_batch(vec![]).await; + assert_eq!(code, 404, "{}", response); } #[actix_rt::test]