diff --git a/meilidb-http/src/routes/document.rs b/meilidb-http/src/routes/document.rs index 19ea90c13..164c129c2 100644 --- a/meilidb-http/src/routes/document.rs +++ b/meilidb-http/src/routes/document.rs @@ -74,7 +74,7 @@ struct BrowseQuery { attributes_to_retrieve: Option, } -pub async fn browse_documents(ctx: Context) -> SResult { +pub async fn get_all_documents(ctx: Context) -> SResult { ctx.is_allowed(DocumentsRead)?; let index = ctx.index()?; @@ -114,15 +114,9 @@ pub async fn browse_documents(ctx: Context) -> SResult { } } - if response_body.is_empty() { - Ok(tide::response::json(response_body) - .with_status(StatusCode::NO_CONTENT) - .into_response()) - } else { - Ok(tide::response::json(response_body) - .with_status(StatusCode::OK) - .into_response()) - } + Ok(tide::response::json(response_body) + .with_status(StatusCode::OK) + .into_response()) } fn infered_schema(document: &IndexMap) -> Option { diff --git a/meilidb-http/src/routes/mod.rs b/meilidb-http/src/routes/mod.rs index e48e9dffa..828b6c678 100644 --- a/meilidb-http/src/routes/mod.rs +++ b/meilidb-http/src/routes/mod.rs @@ -42,7 +42,7 @@ pub fn load_routes(app: &mut tide::App) { router.at("/documents").nest(|router| { router .at("/") - .get(document::browse_documents) + .get(document::get_all_documents) .post(document::add_or_replace_multiple_documents) .put(document::add_or_update_multiple_documents) .delete(document::clear_all_documents);