1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

API root path now returns JSON error, fix GH-150

This commit is contained in:
krateng 2022-05-26 14:43:29 +02:00
parent 1eaba888c7
commit 397d5e7c13

View File

@ -47,9 +47,12 @@ def init_apis(server):
server.get(altpath_empty_cl)(alias_api) server.get(altpath_empty_cl)(alias_api)
server.post(altpath_empty_cl)(alias_api) server.post(altpath_empty_cl)(alias_api)
def invalid_api(pth): def invalid_api(pth=''):
response.status = 404 response.status = 404
return {"error":"Invalid API"} return {"error":"Invalid API"}
server.get("/apis/<pth:path>")(invalid_api) server.get("/apis/<pth:path>")(invalid_api)
server.post("/apis/<pth:path>")(invalid_api) server.post("/apis/<pth:path>")(invalid_api)
server.get("/apis")(invalid_api)
server.post("/apis")(invalid_api)