test if empty

This commit is contained in:
Martin Brodbeck 2023-09-26 20:01:37 +02:00
parent 0e539a39e7
commit 1b1f0f7e68

View file

@ -169,6 +169,13 @@ async fn get_progress(
)
.unwrap();
if values.is_empty() {
return (
StatusCode::FORBIDDEN,
Json(json!(r#""message": "Field 'document' not provided."#)),
);
}
let res = GetProgress {
percentage: values[0].parse().unwrap(),
progress: values[1].clone(),
@ -181,6 +188,6 @@ async fn get_progress(
(StatusCode::OK, Json(json!(res)))
}
async fn healthcheck() -> (StatusCode, String) {
(StatusCode::OK, "{ \"state\" : \"OK\" }".to_owned())
async fn healthcheck() -> (StatusCode, Json<Value>) {
(StatusCode::OK, Json(json!("{ \"state\" : \"OK\" }")))
}