Extract read*_request_body methods

This commit is contained in:
Unrud
2020-09-14 21:19:48 +02:00
parent 42ad18bc84
commit 0ce90d6b34
10 changed files with 63 additions and 51 deletions

View File

@@ -21,7 +21,7 @@ Custom web plugin.
from http import client
from radicale import web
from radicale import httputils, web
class Web(web.BaseWeb):
@@ -29,5 +29,5 @@ class Web(web.BaseWeb):
return client.OK, {"Content-Type": "text/plain"}, "custom"
def post(self, environ, base_prefix, path, user):
answer = "echo:" + environ["wsgi.input"].read().decode()
return client.OK, {"Content-Type": "text/plain"}, answer
content = httputils.read_request_body(self.configuration, environ)
return client.OK, {"Content-Type": "text/plain"}, "echo:" + content