WebHost: restore old silent ignore of mimetypes in json getting (#1292)

* WebHost: restore old silent ignore of mimetypes in json getting of /api/generate

* Tests: add tests for /api/generate
This commit is contained in:
Fabian Dill
2022-12-05 22:27:15 +01:00
committed by GitHub
parent 4412434976
commit 32b8f9f9f3
2 changed files with 44 additions and 1 deletions

View File

@@ -27,7 +27,10 @@ def generate_api():
race = bool(0 if request.form["race"] in {"false"} else int(request.form["race"]))
meta_options_source = request.form
json_data = request.get_json()
# json_data is optional, we can have it silently fall to None as it used to do.
# See https://flask.palletsprojects.com/en/2.2.x/api/#flask.Request.get_json -> Changelog -> 2.1
json_data = request.get_json(silent=True)
if json_data:
meta_options_source = json_data
if 'weights' in json_data: