diff --git a/endpoints/notify.py b/endpoints/notify.py index 0ebb0d1dd2b0de8234477618d7f4893a754effc1..3e0c552569b7ec208a46763b1d5acbf8d0dc71f9 100644 --- a/endpoints/notify.py +++ b/endpoints/notify.py @@ -17,18 +17,19 @@ class Notify(Resource): self.clients = json.load(clients_file) def post(self): - errors = self.schema.validate(request.args) + args = request.get_json() + errors = self.schema.validate(args) if errors: abort(400, message=str(errors)) messages = [] allow = False - body = request.args.get("body") - client_id = request.args.get("client_id") + body = args.get("body") + client_id = args.get("client_id") notify_queue = client_id + "-notify" if client_id in self.clients: client = self.clients.get(client_id) - if request.args.get("secret") == client.get("secret"): + if args.get("secret") == client.get("secret"): allow = True if allow: diff --git a/endpoints/send.py b/endpoints/send.py index 119c67b6f9139bef525d3651c19be247347b688d..d755186e7a80e05f6c86f90d8ea9cc32f82a8351 100644 --- a/endpoints/send.py +++ b/endpoints/send.py @@ -18,19 +18,20 @@ class Send(Resource): self.clients = json.load(clients_file) def post(self): - errors = self.schema.validate(request.args) + args = request.get_json() + errors = self.schema.validate(args) if errors: abort(400, message=str(errors)) messages = [] allow = False - body = request.args.get("body") - topic = request.args.get("topic") - client_id = request.args.get("client_id") + body = args.get("body") + topic = args.get("topic") + client_id = args.get("client_id") outbox_queue = client_id + "-outbox" if client_id in self.clients: client = self.clients.get(client_id) - if request.args.get("secret") == client.get("secret"): + if args.get("secret") == client.get("secret"): allow = True if allow: