inline problem_details builder at call sites; drop the one-caller wrapper
This commit is contained in:
parent
cdf1bfe7db
commit
2b0c51badf
8 changed files with 79 additions and 78 deletions
|
|
@ -13,7 +13,9 @@ use axum::{
|
|||
};
|
||||
use serde::Deserialize;
|
||||
|
||||
use super::{AppState, error_response, problem_response};
|
||||
use problem_details::ProblemDetails;
|
||||
|
||||
use super::{AppState, error_response};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub(super) struct AnswerForm {
|
||||
|
|
@ -41,10 +43,11 @@ pub(super) async fn post_answer_question(
|
|||
) -> Response {
|
||||
let answer = form.answer.trim();
|
||||
if answer.is_empty() {
|
||||
return with_cors(problem_response(
|
||||
StatusCode::BAD_REQUEST,
|
||||
"answer: required",
|
||||
));
|
||||
return with_cors(
|
||||
ProblemDetails::from_status_code(StatusCode::BAD_REQUEST)
|
||||
.with_detail("answer: required")
|
||||
.into_response(),
|
||||
);
|
||||
}
|
||||
let resp = match state
|
||||
.coord
|
||||
|
|
|
|||
Loading…
Reference in a new issue