diff options
author | Kegan Dougal <kegan@matrix.org> | 2014-08-27 11:38:13 +0100 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2014-08-27 11:38:13 +0100 |
commit | a8774cf351c5d1af98ed80dd0da6fadc09af7da3 (patch) | |
tree | 82920cd159ff73e3fd61a6dc5b7100d7f95918af /synapse/rest/room.py | |
parent | Added support for GET /events/$eventid with auth checks. (diff) | |
parent | Final url modifications: renamed /presence_list to /presence/list to keep the... (diff) | |
download | synapse-a8774cf351c5d1af98ed80dd0da6fadc09af7da3.tar.xz |
Merge branch 'client_server_url_rename' into develop
Diffstat (limited to 'synapse/rest/room.py')
-rw-r--r-- | synapse/rest/room.py | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/synapse/rest/room.py b/synapse/rest/room.py index b8d5cb87fd..1cbb31e301 100644 --- a/synapse/rest/room.py +++ b/synapse/rest/room.py @@ -34,31 +34,28 @@ class RoomCreateRestServlet(RestServlet): # No PATTERN; we have custom dispatch rules here def register(self, http_server): - # /rooms OR /rooms/<roomid> - http_server.register_path("POST", - client_path_pattern("/rooms$"), - self.on_POST) - http_server.register_path("PUT", - client_path_pattern( - "/rooms/(?P<room_id>[^/]*)$"), - self.on_PUT) + PATTERN = "/createRoom" + register_txn_path(self, PATTERN, http_server) # define CORS for all of /rooms in RoomCreateRestServlet for simplicity http_server.register_path("OPTIONS", client_path_pattern("/rooms(?:/.*)?$"), self.on_OPTIONS) + # define CORS for /createRoom[/txnid] + http_server.register_path("OPTIONS", + client_path_pattern("/createRoom(?:/.*)?$"), + self.on_OPTIONS) @defer.inlineCallbacks - def on_PUT(self, request, room_id): - room_id = urllib.unquote(room_id) - auth_user = yield self.auth.get_user_by_req(request) + def on_PUT(self, request, txn_id): + try: + defer.returnValue(self.txns.get_client_transaction(request, txn_id)) + except KeyError: + pass - if not room_id: - raise SynapseError(400, "PUT must specify a room ID") + response = yield self.on_POST(request) - room_config = self.get_room_config(request) - info = yield self.make_room(room_config, auth_user, room_id) - room_config.update(info) - defer.returnValue((200, info)) + self.txns.store_client_transaction(request, txn_id, response) + defer.returnValue(response) @defer.inlineCallbacks def on_POST(self, request): |