From a18b1a649c5dd7fbb42fa2b1af0530542b8c3873 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Mon, 18 Aug 2014 15:01:08 +0100 Subject: Added /matrix/content path, HS resource_for_content_repo attribute and FileUploadResource. Added stub methods. --- synapse/http/server.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'synapse/http/server.py') diff --git a/synapse/http/server.py b/synapse/http/server.py index bad2738bde..f86151e51c 100644 --- a/synapse/http/server.py +++ b/synapse/http/server.py @@ -25,6 +25,7 @@ from twisted.web.server import NOT_DONE_YET from twisted.web.util import redirectTo import collections +import json import logging @@ -176,6 +177,33 @@ class RootRedirect(resource.Resource): return resource.Resource.getChild(self, name, request) +class FileUploadResource(resource.Resource): + isLeaf = True + + def __init__(self, directory): + resource.Resource.__init__(self) + self.directory = directory + + def render(self, request): + self._async_render(request) + return server.NOT_DONE_YET + + # @defer.inlineCallbacks + def _async_render(self, request): + request.setResponseCode(200) + request.setHeader(b"Content-Type", b"application/json") + + request.setHeader("Access-Control-Allow-Origin", "*") + request.setHeader("Access-Control-Allow-Methods", + "GET, POST, PUT, DELETE, OPTIONS") + request.setHeader("Access-Control-Allow-Headers", + "Origin, X-Requested-With, Content-Type, Accept") + + request.write(json.dumps({"url": "not_implemented"})) + request.finish() + defer.succeed("not implemented") + + def respond_with_json_bytes(request, code, json_bytes, send_cors=False): """Sends encoded JSON in response to the given request. -- cgit 1.4.1