diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2016-09-09 14:34:29 +0100 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2016-09-09 14:34:29 +0100 |
commit | 0fc0a3bdfff6f89ae0d952cc2bbc2843dbebdbf3 (patch) | |
tree | 7bc127954485e4d42a70bc2b076bf075a5627c79 | |
parent | Merge pull request #1092 from matrix-org/erikj/transaction_queue_check (diff) | |
download | synapse-0fc0a3bdfff6f89ae0d952cc2bbc2843dbebdbf3.tar.xz |
Allow clients to specify the format a room state event is returned in
-rw-r--r-- | synapse/rest/client/v1/room.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py index 3c933f1620..2d7d89da04 100644 --- a/synapse/rest/client/v1/room.py +++ b/synapse/rest/client/v1/room.py @@ -120,6 +120,8 @@ class RoomStateEventRestServlet(ClientV1RestServlet): @defer.inlineCallbacks def on_GET(self, request, room_id, event_type, state_key): requester = yield self.auth.get_user_by_req(request, allow_guest=True) + format = parse_string(request, "format", default="content", + allowed_values=["content", "event"]) msg_handler = self.handlers.message_handler data = yield msg_handler.get_room_data( @@ -134,7 +136,11 @@ class RoomStateEventRestServlet(ClientV1RestServlet): raise SynapseError( 404, "Event not found.", errcode=Codes.NOT_FOUND ) - defer.returnValue((200, data.get_dict()["content"])) + + if format == "event": + defer.returnValue((200, data.get_dict())) + elif format == "content": + defer.returnValue((200, data.get_dict()["content"])) @defer.inlineCallbacks def on_PUT(self, request, room_id, event_type, state_key, txn_id=None): |