web.none: Redirect instead of 404
This commit is contained in:
parent
22fc38850c
commit
685a91bfe6
@ -36,7 +36,8 @@ class TestBaseWebRequests(BaseTest):
|
|||||||
self.configure({"web": {"type": "none"}})
|
self.configure({"web": {"type": "none"}})
|
||||||
_, answer = self.get("/.web")
|
_, answer = self.get("/.web")
|
||||||
assert answer
|
assert answer
|
||||||
self.get("/.web/", check=404)
|
_, headers, _ = self.request("GET", "/.web/", check=302)
|
||||||
|
assert headers.get("Location") == "/.web"
|
||||||
self.post("/.web", check=405)
|
self.post("/.web", check=405)
|
||||||
|
|
||||||
def test_custom(self) -> None:
|
def test_custom(self) -> None:
|
||||||
|
@ -31,5 +31,5 @@ class Web(web.BaseWeb):
|
|||||||
assert path == "/.web" or path.startswith("/.web/")
|
assert path == "/.web" or path.startswith("/.web/")
|
||||||
assert pathutils.sanitize_path(path) == path
|
assert pathutils.sanitize_path(path) == path
|
||||||
if path != "/.web":
|
if path != "/.web":
|
||||||
return httputils.NOT_FOUND
|
return httputils.redirect(base_prefix + "/.web")
|
||||||
return client.OK, {"Content-Type": "text/plain"}, "Radicale works!"
|
return client.OK, {"Content-Type": "text/plain"}, "Radicale works!"
|
||||||
|
Loading…
Reference in New Issue
Block a user