Skip to content

Commit 24df7c1

Browse files
committed
404 to 204
1 parent c3b48f1 commit 24df7c1

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

surftimer/ck_bonus.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ def selectPersonalBonusRecords(
179179

180180
if len(xquery) <= 0:
181181
response.headers["content-type"] = "application/json"
182-
response.status_code = status.HTTP_404_NOT_FOUND
183-
response.body = {"xtime": time.perf_counter() - tic}
182+
response.status_code = status.HTTP_204_NO_CONTENT
184183
return response
185184

186185
toc = time.perf_counter()
@@ -230,8 +229,7 @@ def selectPlayerRankBonus(
230229

231230
if len(xquery) <= 0:
232231
response.headers["content-type"] = "application/json"
233-
response.status_code = status.HTTP_404_NOT_FOUND
234-
response.body = {"xtime": time.perf_counter() - tic}
232+
response.status_code = status.HTTP_204_NO_CONTENT
235233
return response
236234

237235
toc = time.perf_counter()
@@ -270,8 +268,7 @@ def selectFastestBonus(
270268

271269
if len(xquery) <= 0:
272270
response.headers["content-type"] = "application/json"
273-
response.status_code = status.HTTP_404_NOT_FOUND
274-
response.body = {"xtime": time.perf_counter() - tic}
271+
response.status_code = status.HTTP_204_NO_CONTENT
275272
return response
276273

277274
toc = time.perf_counter()
@@ -310,8 +307,7 @@ def selectAllBonusTimesinMap(
310307

311308
if len(xquery) <= 0:
312309
response.headers["content-type"] = "application/json"
313-
response.status_code = status.HTTP_404_NOT_FOUND
314-
response.body = {"xtime": time.perf_counter() - tic}
310+
response.status_code = status.HTTP_204_NO_CONTENT
315311
return response
316312

317313
toc = time.perf_counter()
@@ -359,8 +355,7 @@ def selectTopBonusSurfers(
359355

360356
if len(xquery) <= 0:
361357
response.headers["content-type"] = "application/json"
362-
response.status_code = status.HTTP_404_NOT_FOUND
363-
response.body = {"xtime": time.perf_counter() - tic}
358+
response.status_code = status.HTTP_204_NO_CONTENT
364359
return response
365360

366361
toc = time.perf_counter()

surftimer/ck_latestrecords.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ async def selectLatestRecord(request: Request, response: Response):
4545
xquery = selectQuery(surftimer.queries.sql_selectLatestRecords)
4646

4747
if len(xquery) <= 0:
48-
return JSONResponse(
49-
status_code=status.HTTP_404_NOT_FOUND,
50-
content={"xtime": time.perf_counter() - tic},
51-
)
48+
response.headers["content-type"] = "application/json"
49+
response.status_code = status.HTTP_204_NO_CONTENT
50+
return response
5251

5352
toc = time.perf_counter()
5453
print(f"Execution time {toc - tic:0.4f}")

0 commit comments

Comments
 (0)