aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFulgen301 <tokmajigeorge@gmail.com>2018-10-14 18:39:17 +0200
committerFulgen301 <tokmajigeorge@gmail.com>2018-10-14 18:39:17 +0200
commitfe231dcb0ecfaa9675ffccd75bfd79ad74634fb2 (patch)
tree8f220b278c53431ca5c430ddd8b42974e7a18629
parent5495f8f07254efe6b6926514101c88ee69533318 (diff)
downloadparry-fe231dcb0ecfaa9675ffccd75bfd79ad74634fb2.tar.gz
parry-fe231dcb0ecfaa9675ffccd75bfd79ad74634fb2.zip
Fix default route
-rw-r--r--__main__.py4
-rw-r--r--helpers.py5
2 files changed, 3 insertions, 6 deletions
diff --git a/__main__.py b/__main__.py
index 95b78ab..44f9892 100644
--- a/__main__.py
+++ b/__main__.py
@@ -18,10 +18,6 @@ from .routes import *
import time
sys.tracebacklimit = 1000
-@route("/api")
-def get_root():
- notAllowed()
-
if __name__ == "__main__":
def loadEntries():
for handler in [CC(), CCAN()]:
diff --git a/helpers.py b/helpers.py
index c748839..f3caac6 100644
--- a/helpers.py
+++ b/helpers.py
@@ -53,8 +53,9 @@ def calculateHashForFile(file, hashobj : object = None) -> object:
return hashobj
-def notAllowed():
- raise HTTPResponse(f"Cannot {request.method} {request.path}")
+@route("<path:path>")
+def default(path):
+ raise HTTPResponse(f"Cannot {request.method} {path}", 405)
@route("<path:path>", method="OPTIONS")
def options(path):