summary refs log tree commit diff
path: root/synapse/http/servlet.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2017-03-08 11:37:34 +0000
committerDavid Baker <dave@matrix.org>2017-03-08 11:37:34 +0000
commit2e27339add58f71485af873cc70284d0bcc2a6bb (patch)
tree938270189a119490bcfcfebfeee6473d2b93579e /synapse/http/servlet.py
parentFactor out msisdn canonicalisation (diff)
downloadsynapse-2e27339add58f71485af873cc70284d0bcc2a6bb.tar.xz
Refector out assert_params_in_request
and replace requestEmailToken where we meant requestMsisdnToken
Diffstat (limited to 'synapse/http/servlet.py')
-rw-r--r--synapse/http/servlet.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/http/servlet.py b/synapse/http/servlet.py
index 8c22d6f00f..9a4c36ad5d 100644
--- a/synapse/http/servlet.py
+++ b/synapse/http/servlet.py
@@ -192,6 +192,16 @@ def parse_json_object_from_request(request):
     return content
 
 
+def assert_params_in_request(body, required):
+    absent = []
+    for k in required:
+        if k not in body:
+            absent.append(k)
+
+    if len(absent) > 0:
+        raise SynapseError(400, "Missing params: %r" % absent, Codes.MISSING_PARAM)
+
+
 class RestServlet(object):
 
     """ A Synapse REST Servlet.