mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-30 00:34:26 +01:00
Merge #106
106: return 202 on settings update / reset r=MarinPostma a=irevoire closes #105 Co-authored-by: Irevoire <tamo@meilisearch.com>
This commit is contained in:
commit
1640d9ea91
@ -131,7 +131,7 @@ async fn update_all(
|
|||||||
.update_settings(index_uid.into_inner(), body.into_inner(), true)
|
.update_settings(index_uid.into_inner(), body.into_inner(), true)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(update_result) => Ok(HttpResponse::Ok().json(update_result)),
|
Ok(update_result) => Ok(HttpResponse::Accepted().json(update_result)),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() })))
|
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)
|
.update_settings(index_uid.into_inner(), settings, false)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(update_result) => Ok(HttpResponse::Ok().json(update_result)),
|
Ok(update_result) => Ok(HttpResponse::Accepted().json(update_result)),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() })))
|
Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() })))
|
||||||
}
|
}
|
||||||
|
@ -101,9 +101,11 @@ async fn update_setting_unexisting_index() {
|
|||||||
let server = Server::new().await;
|
let server = Server::new().await;
|
||||||
let index = server.index("test");
|
let index = server.index("test");
|
||||||
let (_response, code) = index.update_settings(json!({})).await;
|
let (_response, code) = index.update_settings(json!({})).await;
|
||||||
assert_eq!(code, 200);
|
assert_eq!(code, 202);
|
||||||
let (_response, code) = index.get().await;
|
let (_response, code) = index.get().await;
|
||||||
assert_eq!(code, 200);
|
assert_eq!(code, 200);
|
||||||
|
let (_response, code) = index.delete_settings().await;
|
||||||
|
assert_eq!(code, 202);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
|
Loading…
Reference in New Issue
Block a user