Skip to content
Snippets Groups Projects
Unverified Commit 926e5ddf authored by Sebastian Höffner's avatar Sebastian Höffner
Browse files

Making form handling more resilient if more than just the key 'sentence' are passed.

parent 0b496cf3
No related branches found
No related tags found
No related merge requests found
......@@ -51,10 +51,13 @@ def parse():
if request.method == 'GET':
return json.dumps(dict(error="Use POST.", http_status=501)), 501
try:
key = next(request.values.keys())
except StopIteration:
key = None
if 'sentence' not in request.values:
try:
key = next(request.values.keys())
except StopIteration:
key = None
else:
key = 'sentence'
# Get sentence from form field or use the first key.
# The first key could be send e.g. by
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment