return accurate http status codes for dashboard client errors

This commit is contained in:
damocles 2026-06-22 13:57:27 +02:00 committed by mara
commit 5dc1b3933a
7 changed files with 63 additions and 22 deletions

View file

@ -13,7 +13,7 @@ use axum::{
};
use serde::Deserialize;
use super::{AppState, error_response};
use super::{AppState, error_response, problem_response};
#[derive(Deserialize)]
pub(super) struct AnswerForm {
@ -41,7 +41,10 @@ pub(super) async fn post_answer_question(
) -> Response {
let answer = form.answer.trim();
if answer.is_empty() {
return with_cors(error_response("answer: required"));
return with_cors(problem_response(
StatusCode::BAD_REQUEST,
"answer: required",
));
}
let resp = match state
.coord