mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
fix more settings routes
This commit is contained in:
parent
79c63049d7
commit
73973e2b9e
@ -27,7 +27,9 @@ macro_rules! make_setting_route {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
match data.update_settings(index_uid.into_inner(), settings, false).await {
|
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) => {
|
Err(e) => {
|
||||||
Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() })))
|
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 {
|
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) => {
|
Err(e) => {
|
||||||
Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() })))
|
Ok(HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() })))
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ macro_rules! test_setting_routes {
|
|||||||
.map(|c| if c == '_' { '-' } else { c })
|
.map(|c| if c == '_' { '-' } else { c })
|
||||||
.collect::<String>());
|
.collect::<String>());
|
||||||
let (response, code) = server.service.post(url, serde_json::Value::Null).await;
|
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;
|
let (response, code) = server.index("test").get().await;
|
||||||
assert_eq!(code, 200, "{}", response);
|
assert_eq!(code, 200, "{}", response);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user