From c8b05712fa1701e1980bc3bd1101f7c9c0b7fb2f Mon Sep 17 00:00:00 2001 From: Irevoire Date: Wed, 17 Mar 2021 14:44:32 +0100 Subject: [PATCH 1/2] return 202 on settings update / reset --- meilisearch-http/src/routes/settings/mod.rs | 4 ++-- meilisearch-http/tests/settings/get_settings.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/meilisearch-http/src/routes/settings/mod.rs b/meilisearch-http/src/routes/settings/mod.rs index 6a7bfce48..ee9b3e325 100644 --- a/meilisearch-http/src/routes/settings/mod.rs +++ b/meilisearch-http/src/routes/settings/mod.rs @@ -131,7 +131,7 @@ async fn update_all( .update_settings(index_uid.into_inner(), body.into_inner(), true) .await { - Ok(update_result) => Ok(HttpResponse::Ok().json(update_result)), + Ok(update_result) => Ok(HttpResponse::Accepted().json(update_result)), Err(e) => { Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() }))) } @@ -161,7 +161,7 @@ async fn delete_all( .update_settings(index_uid.into_inner(), settings, false) .await { - Ok(update_result) => Ok(HttpResponse::Ok().json(update_result)), + Ok(update_result) => Ok(HttpResponse::Accepted().json(update_result)), Err(e) => { Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() }))) } diff --git a/meilisearch-http/tests/settings/get_settings.rs b/meilisearch-http/tests/settings/get_settings.rs index e4c38cb00..ac1d9df53 100644 --- a/meilisearch-http/tests/settings/get_settings.rs +++ b/meilisearch-http/tests/settings/get_settings.rs @@ -101,7 +101,7 @@ async fn update_setting_unexisting_index() { let server = Server::new().await; let index = server.index("test"); let (_response, code) = index.update_settings(json!({})).await; - assert_eq!(code, 200); + assert_eq!(code, 202); let (_response, code) = index.get().await; assert_eq!(code, 200); } From 6b4ea7f5942c496280d62c77661375c60c94e608 Mon Sep 17 00:00:00 2001 From: Irevoire Date: Wed, 17 Mar 2021 15:09:13 +0100 Subject: [PATCH 2/2] ensure the reset_settings also return a 202 --- meilisearch-http/tests/settings/get_settings.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meilisearch-http/tests/settings/get_settings.rs b/meilisearch-http/tests/settings/get_settings.rs index ac1d9df53..1cbfdbb1d 100644 --- a/meilisearch-http/tests/settings/get_settings.rs +++ b/meilisearch-http/tests/settings/get_settings.rs @@ -104,6 +104,8 @@ async fn update_setting_unexisting_index() { assert_eq!(code, 202); let (_response, code) = index.get().await; assert_eq!(code, 200); + let (_response, code) = index.delete_settings().await; + assert_eq!(code, 202); } #[actix_rt::test]