Adding some helpful info for the response body
This commit is contained in:
+4
-1
@@ -743,16 +743,19 @@ pub mod endpoint {
|
|||||||
|
|
||||||
let raw_data: Vec<u8> = data.to_vec();
|
let raw_data: Vec<u8> = data.to_vec();
|
||||||
match song_queue::update(&pool, &raw_data, &id).await {
|
match song_queue::update(&pool, &raw_data, &id).await {
|
||||||
Ok(_queued_data) => {
|
Ok(_) => {
|
||||||
|
response.subject = String::from("Successful");
|
||||||
response.data.push(id);
|
response.data.push(id);
|
||||||
(axum::http::StatusCode::OK, axum::Json(response))
|
(axum::http::StatusCode::OK, axum::Json(response))
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
response.subject = String::from("Error");
|
||||||
response.message = err.to_string();
|
response.message = err.to_string();
|
||||||
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
response.subject = String::from("Error");
|
||||||
response.message = String::from("No data provided");
|
response.message = String::from("No data provided");
|
||||||
(axum::http::StatusCode::NOT_FOUND, axum::Json(response))
|
(axum::http::StatusCode::NOT_FOUND, axum::Json(response))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user