fix(exam): 批阅端点增加 answers 类型校验,非数组返回 400 而非 500
This commit is contained in:
@@ -356,6 +356,8 @@ def api_grade_answers():
|
||||
answers = data.get('answers', [])
|
||||
if not answers:
|
||||
return error_response("MISSING_PARAMS", BAD_REQUEST, "缺少答案数据", http_status=400)
|
||||
if not isinstance(answers, list):
|
||||
return error_response("INVALID_PARAMS", BAD_REQUEST, "answers 必须为数组", http_status=400)
|
||||
|
||||
# 校验每道题的 question_type
|
||||
for i, ans in enumerate(answers):
|
||||
|
||||
Reference in New Issue
Block a user