diff --git a/radicale/app/post.py b/radicale/app/post.py index 723b8e9..a3de951 100644 --- a/radicale/app/post.py +++ b/radicale/app/post.py @@ -26,5 +26,4 @@ class ApplicationPostMixin: """Manage POST request.""" if path == "/.web" or path.startswith("/.web/"): return self._web.post(environ, base_prefix, path, user) - return httputils.METHOD_NOT_ALLOWED diff --git a/radicale/tests/__init__.py b/radicale/tests/__init__.py index 1824bd1..e2e283e 100644 --- a/radicale/tests/__init__.py +++ b/radicale/tests/__init__.py @@ -104,8 +104,8 @@ class BaseTest: self._check_status(status, 200, check) return status, answer - def post(self, path, check=True, **args): - status, _, answer = self.request("POST", path, **args) + def post(self, path, data=None, check=True, **args): + status, _, answer = self.request("POST", path, data, **args) self._check_status(status, 200, check) return status, answer diff --git a/radicale/tests/custom/web.py b/radicale/tests/custom/web.py index 7d11902..3a8f5bd 100644 --- a/radicale/tests/custom/web.py +++ b/radicale/tests/custom/web.py @@ -29,4 +29,5 @@ class Web(web.BaseWeb): return client.OK, {"Content-Type": "text/plain"}, "custom" def post(self, environ, base_prefix, path, user): - return client.OK, {"Content-Type": "text/plain"}, "custom post" + answer = "echo:" + environ["wsgi.input"].read().decode() + return client.OK, {"Content-Type": "text/plain"}, answer diff --git a/radicale/tests/test_web.py b/radicale/tests/test_web.py index f5fed54..5d2b792 100644 --- a/radicale/tests/test_web.py +++ b/radicale/tests/test_web.py @@ -48,6 +48,7 @@ class TestBaseWebRequests(BaseTest): assert headers.get("Location") == ".web/" _, answer = self.get("/.web/") assert answer + self.post("/.web", check=405) def test_none(self): self.configuration.update({"web": {"type": "none"}}, "test") @@ -55,6 +56,7 @@ class TestBaseWebRequests(BaseTest): _, answer = self.get("/.web") assert answer self.get("/.web/", check=404) + self.post("/.web", check=405) def test_custom(self): """Custom web plugin.""" @@ -63,6 +65,5 @@ class TestBaseWebRequests(BaseTest): self.application = Application(self.configuration) _, answer = self.get("/.web") assert answer == "custom" - - _, answer = self.post("/.web") - assert answer == "custom post" + _, answer = self.post("/.web", "body content") + assert answer == "echo:body content"