Pass allowed arguments into missing args error

This commit is contained in:
Emily 2018-05-31 11:03:06 +02:00
parent 4710e6ba7b
commit 807c06504f
2 changed files with 8 additions and 2 deletions

View File

@ -4,7 +4,10 @@ allowed_args = ["file_hash", "file_version", "timestamp"]
def handle(request): def handle(request):
if len([x for x in request.args if x in allowed_args]) == 0: if len([x for x in request.args if x in allowed_args]) == 0:
return {"error": "Missing valid args"} return {
"error": "Missing valid args",
"allowed": allowed_args
}
for i in range(len(allowed_args)): # Gets the first valid argument and sets it as the method handler for i in range(len(allowed_args)): # Gets the first valid argument and sets it as the method handler
method = request.args.get(allowed_args[i]) method = request.args.get(allowed_args[i])

View File

@ -4,7 +4,10 @@ allowed_args = ["file_hash", "file_version", "timestamp"]
def handle(request): def handle(request):
if len([x for x in request.args if x in allowed_args]) == 0: if len([x for x in request.args if x in allowed_args]) == 0:
return {"error": "Missing valid args"} return {
"error": "Missing valid args",
"allowed": allowed_args
}
for i in range(len(allowed_args)): # Gets the first valid argument and sets it as the method handler for i in range(len(allowed_args)): # Gets the first valid argument and sets it as the method handler
method = request.args.get(allowed_args[i]) method = request.args.get(allowed_args[i])