forked from Dniel97/artemis
title: add 405 and 404 error responses
This commit is contained in:
parent
6b0838062e
commit
5965362a0f
@ -53,10 +53,13 @@ class TitleServlet():
|
|||||||
code = endpoints["game"]
|
code = endpoints["game"]
|
||||||
if code not in self.title_registry:
|
if code not in self.title_registry:
|
||||||
self.logger.warn(f"Unknown game code {code}")
|
self.logger.warn(f"Unknown game code {code}")
|
||||||
|
request.setResponseCode(404)
|
||||||
|
return b""
|
||||||
|
|
||||||
index = self.title_registry[code]
|
index = self.title_registry[code]
|
||||||
if not hasattr(index, "render_GET"):
|
if not hasattr(index, "render_GET"):
|
||||||
self.logger.warn(f"{code} does not dispatch GET")
|
self.logger.warn(f"{code} does not dispatch GET")
|
||||||
|
request.setResponseCode(405)
|
||||||
return b""
|
return b""
|
||||||
|
|
||||||
return index.render_GET(request, endpoints["version"], endpoints["endpoint"])
|
return index.render_GET(request, endpoints["version"], endpoints["endpoint"])
|
||||||
@ -65,10 +68,13 @@ class TitleServlet():
|
|||||||
code = endpoints["game"]
|
code = endpoints["game"]
|
||||||
if code not in self.title_registry:
|
if code not in self.title_registry:
|
||||||
self.logger.warn(f"Unknown game code {code}")
|
self.logger.warn(f"Unknown game code {code}")
|
||||||
|
request.setResponseCode(404)
|
||||||
|
return b""
|
||||||
|
|
||||||
index = self.title_registry[code]
|
index = self.title_registry[code]
|
||||||
if not hasattr(index, "render_POST"):
|
if not hasattr(index, "render_POST"):
|
||||||
self.logger.warn(f"{code} does not dispatch POST")
|
self.logger.warn(f"{code} does not dispatch POST")
|
||||||
|
request.setResponseCode(405)
|
||||||
return b""
|
return b""
|
||||||
|
|
||||||
return index.render_POST(request, int(endpoints["version"]), endpoints["endpoint"])
|
return index.render_POST(request, int(endpoints["version"]), endpoints["endpoint"])
|
||||||
|
Loading…
Reference in New Issue
Block a user