test if empty
This commit is contained in:
parent
0e539a39e7
commit
1b1f0f7e68
1 changed files with 9 additions and 2 deletions
11
src/main.rs
11
src/main.rs
|
@ -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\" }")))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue