diff options
author | Will Hunt <will@half-shot.uk> | 2018-07-27 12:01:13 +0100 |
---|---|---|
committer | Will Hunt <will@half-shot.uk> | 2018-07-27 12:01:13 +0100 |
commit | 8cc46ed4a6ec2fe82678f94fd908b9a711372d76 (patch) | |
tree | 12762e09a486a929cc77dfc83dd4d8b35e09ef69 | |
parent | wrapped (diff) | |
download | synapse-8cc46ed4a6ec2fe82678f94fd908b9a711372d76.tar.xz |
wrap_json_request_handlering
-rw-r--r-- | synapse/rest/media/v1/config_resource.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/synapse/rest/media/v1/config_resource.py b/synapse/rest/media/v1/config_resource.py index 2272e35b0c..c53ba28540 100644 --- a/synapse/rest/media/v1/config_resource.py +++ b/synapse/rest/media/v1/config_resource.py @@ -13,9 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from twisted.web.server import NOT_DONE_YET + +from twisted.internet import defer from twisted.web.resource import Resource -from synapse.http.server import respond_with_json, respond_with_json_bytes, wrap_json_request_handler +from twisted.web.server import NOT_DONE_YET +from synapse.http.server import respond_with_json, wrap_json_request_handler class MediaConfigResource(Resource): @@ -24,15 +26,19 @@ class MediaConfigResource(Resource): def __init__(self, hs): Resource.__init__(self) config = hs.get_config() + self.clock = hs.get_clock() self.limits_dict = { "m.upload.size": config.max_upload_size, } - @wrap_json_request_handler def render_GET(self, request): - respond_with_json(request, 200, self.limits_dict, send_cors=True) + self._async_render_GET(request) return NOT_DONE_YET + @wrap_json_request_handler + def _async_render_GET(self, request): + return respond_with_json(request, 200, self.limits_dict) + def render_OPTIONS(self, request): - respond_with_json_bytes(request, 200, {}, send_cors=True) - return NOT_DONE_YET + respond_with_json(request, 200, {}, send_cors=True) + return NOT_DONE_YET \ No newline at end of file |