Unverified Commit 7c6c1d16 authored by Dan Jones's avatar Dan Jones
Browse files

refactor: change send notify to parse posted json

parent 40590158
......@@ -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:
......
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment