From 73973e2b9ef2f93aabc9dfc22fa787b187bfd058 Mon Sep 17 00:00:00 2001 From: tamo Date: Thu, 1 Apr 2021 15:50:45 +0200 Subject: [PATCH] fix more settings routes --- meilisearch-http/src/routes/settings/mod.rs | 8 ++++++-- meilisearch-http/tests/settings/get_settings.rs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/meilisearch-http/src/routes/settings/mod.rs b/meilisearch-http/src/routes/settings/mod.rs index b5989bf87..8c6e04b84 100644 --- a/meilisearch-http/src/routes/settings/mod.rs +++ b/meilisearch-http/src/routes/settings/mod.rs @@ -27,7 +27,9 @@ macro_rules! make_setting_route { ..Default::default() }; match data.update_settings(index_uid.into_inner(), settings, false).await { - Ok(update_status) => Ok(HttpResponse::Ok().json(update_status)), + Ok(update_status) => { + Ok(HttpResponse::Accepted().json(serde_json::json!({ "updateId": update_status.id() }))) + } Err(e) => { Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() }))) } @@ -46,7 +48,9 @@ macro_rules! make_setting_route { }; match data.update_settings(index_uid.into_inner(), settings, true).await { - Ok(update_status) => Ok(HttpResponse::Ok().json(update_status)), + Ok(update_status) => { + Ok(HttpResponse::Accepted().json(serde_json::json!({ "updateId": update_status.id() }))) + } 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 b1030aea9..d234cbb2b 100644 --- a/meilisearch-http/tests/settings/get_settings.rs +++ b/meilisearch-http/tests/settings/get_settings.rs @@ -142,7 +142,7 @@ macro_rules! test_setting_routes { .map(|c| if c == '_' { '-' } else { c }) .collect::()); let (response, code) = server.service.post(url, serde_json::Value::Null).await; - assert_eq!(code, 200, "{}", response); + assert_eq!(code, 202, "{}", response); let (response, code) = server.index("test").get().await; assert_eq!(code, 200, "{}", response); }