mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-22 07:51:00 +00:00
Merge pull request #504 from rrgeorge/allow_json_suggest
Allow json submission to /suggest
This commit is contained in:
commit
ce25eec774
1 changed files with 11 additions and 4 deletions
|
@ -1038,6 +1038,13 @@ def create_app(args):
|
|||
if not args.suggestions:
|
||||
abort(403, description=_("Suggestions are disabled on this server."))
|
||||
|
||||
if request.is_json:
|
||||
json = get_json_dict(request)
|
||||
q = json.get("q")
|
||||
s = json.get("s")
|
||||
source_lang = json.get("source")
|
||||
target_lang = json.get("target")
|
||||
else:
|
||||
q = request.values.get("q")
|
||||
s = request.values.get("s")
|
||||
source_lang = request.values.get("source")
|
||||
|
|
Loading…
Reference in a new issue