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