diff options
author | Jeroen <vo.jeroen@gmail.com> | 2018-07-14 20:24:46 +0200 |
---|---|---|
committer | Jeroen <vo.jeroen@gmail.com> | 2018-07-14 20:24:46 +0200 |
commit | 505530f36abba53234c2fa29262a0de87face4fb (patch) | |
tree | 313bbefb0f7b9693f1189a86410fe3dcdb9207f7 /synapse/rest/client/v1/directory.py | |
parent | Merge branch 'develop' into send_sni_for_federation_requests (diff) | |
parent | Fix develop because I broke it :( (#3535) (diff) | |
download | synapse-505530f36abba53234c2fa29262a0de87face4fb.tar.xz |
Merge remote-tracking branch 'upstream/develop' into send_sni_for_federation_requests
# Conflicts: # synapse/crypto/context_factory.py
Diffstat (limited to 'synapse/rest/client/v1/directory.py')
-rw-r--r-- | synapse/rest/client/v1/directory.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/synapse/rest/client/v1/directory.py b/synapse/rest/client/v1/directory.py index 1c3933380f..69dcd618cb 100644 --- a/synapse/rest/client/v1/directory.py +++ b/synapse/rest/client/v1/directory.py @@ -14,17 +14,16 @@ # limitations under the License. +import logging + from twisted.internet import defer -from synapse.api.errors import AuthError, SynapseError, Codes -from synapse.types import RoomAlias +from synapse.api.errors import AuthError, Codes, SynapseError from synapse.http.servlet import parse_json_object_from_request +from synapse.types import RoomAlias from .base import ClientV1RestServlet, client_path_patterns -import logging - - logger = logging.getLogger(__name__) @@ -53,15 +52,14 @@ class ClientDirectoryServer(ClientV1RestServlet): @defer.inlineCallbacks def on_PUT(self, request, room_alias): + room_alias = RoomAlias.from_string(room_alias) + content = parse_json_object_from_request(request) if "room_id" not in content: - raise SynapseError(400, "Missing room_id key", + raise SynapseError(400, 'Missing params: ["room_id"]', errcode=Codes.BAD_JSON) logger.debug("Got content: %s", content) - - room_alias = RoomAlias.from_string(room_alias) - logger.debug("Got room name: %s", room_alias.to_string()) room_id = content["room_id"] |