From fe231dcb0ecfaa9675ffccd75bfd79ad74634fb2 Mon Sep 17 00:00:00 2001 From: Fulgen301 Date: Sun, 14 Oct 2018 18:39:17 +0200 Subject: Fix default route --- __main__.py | 4 ---- helpers.py | 5 +++-- 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("") +def default(path): + raise HTTPResponse(f"Cannot {request.method} {path}", 405) @route("", method="OPTIONS") def options(path): -- cgit v1.2.3-54-g00ecf