File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 11from starlette .endpoints import HTTPEndpoint
22from starlette .responses import PlainTextResponse
33from submodules .model .business_objects import general
4+ from starlette import status
45
56
67class Healthcheck (HTTPEndpoint ):
78 def get (self , request ) -> PlainTextResponse :
8- headers = {"APP" : "OK" }
9+ text = ""
10+ status_code = status .HTTP_200_OK
911 database_test = general .test_database_connection ()
1012 if not database_test .get ("success" ):
11- headers ["DATABASE" ] = database_test .get ("error" )
12- return PlainTextResponse ("OK" , headers = headers )
13+ error_name = database_test .get ("error" )
14+ text += f"database_error:{ error_name } :"
15+ status_code = status .HTTP_500_INTERNAL_SERVER_ERROR
16+ if not text :
17+ text = "OK"
18+ return PlainTextResponse (text , status_code = status_code )
You can’t perform that action at this time.
0 commit comments