summary refs log tree commit diff
path: root/synapse/rest/client/v2_alpha/register.py
diff options
context:
space:
mode:
authorKrombel <krombel@krombel.de>2018-07-13 21:53:01 +0200
committerKrombel <krombel@krombel.de>2018-07-13 21:53:01 +0200
commit3366b9c534cc286fcbe218ab718fd9a9c6211da4 (patch)
treec75be15b5880253c3c37ac23ad8421036e4e798b /synapse/rest/client/v2_alpha/register.py
parentUse parse_{int,str} and assert from http.servlet (diff)
downloadsynapse-3366b9c534cc286fcbe218ab718fd9a9c6211da4.tar.xz
rename assert_params_in_request to assert_params_in_dict
the method "assert_params_in_request" does handle dicts and not
requests. A request body has to be parsed to json before this method
can be used
Diffstat (limited to 'synapse/rest/client/v2_alpha/register.py')
-rw-r--r--synapse/rest/client/v2_alpha/register.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py
index e2023e3a61..0d0eeb8c0b 100644
--- a/synapse/rest/client/v2_alpha/register.py
+++ b/synapse/rest/client/v2_alpha/register.py
@@ -29,7 +29,7 @@ from synapse.api.constants import LoginType
 from synapse.api.errors import Codes, SynapseError, UnrecognizedRequestError
 from synapse.http.servlet import (
     RestServlet,
-    assert_params_in_request,
+    assert_params_in_dict,
     parse_json_object_from_request,
     parse_string,
 )
@@ -69,7 +69,7 @@ class EmailRegisterRequestTokenRestServlet(RestServlet):
     def on_POST(self, request):
         body = parse_json_object_from_request(request)
 
-        assert_params_in_request(body, [
+        assert_params_in_dict(body, [
             'id_server', 'client_secret', 'email', 'send_attempt'
         ])
 
@@ -105,7 +105,7 @@ class MsisdnRegisterRequestTokenRestServlet(RestServlet):
     def on_POST(self, request):
         body = parse_json_object_from_request(request)
 
-        assert_params_in_request(body, [
+        assert_params_in_dict(body, [
             'id_server', 'client_secret',
             'country', 'phone_number',
             'send_attempt',
@@ -387,7 +387,7 @@ class RegisterRestServlet(RestServlet):
             add_msisdn = False
         else:
             # NB: This may be from the auth handler and NOT from the POST
-            assert_params_in_request(params, ["password"])
+            assert_params_in_dict(params, ["password"])
 
             desired_username = params.get("username", None)
             new_password = params.get("password", None)
@@ -565,7 +565,7 @@ class RegisterRestServlet(RestServlet):
             defer.Deferred:
         """
         try:
-            assert_params_in_request(threepid, ['medium', 'address', 'validated_at'])
+            assert_params_in_dict(threepid, ['medium', 'address', 'validated_at'])
         except SynapseError as ex:
             if ex.errcode == Codes.MISSING_PARAM:
                 # This will only happen if the ID server returns a malformed response