Skip to content

Commit 40ab258

Browse files
committed
Updated healthcheck response handling to include status-based 503 or 200 codes, ensuring proper HTTP response for "UNAVAILABLE" status.
1 parent ffcdfef commit 40ab258

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

handler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ def handle_muEd_command(event: JsonType, command: str) -> HandlerResponse:
136136
elif command == "healthcheck":
137137
response = commands.healthcheck_muEd()
138138
validate.body(response, MuEdResBodyValidators.HEALTHCHECK)
139+
status_code = 503 if response.get("status") == "UNAVAILABLE" else 200
140+
return wrap_muEd_response(response, event, status_code)
139141

140142
else:
141143
error = {

tools/commands.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class CaseResult(NamedTuple):
5555

5656
is_correct: bool = False
5757
feedback: str = ""
58+
5859
warning: Optional[CaseWarning] = None
5960

6061

0 commit comments

Comments
 (0)