From 03bbb4df4e7a6a6b0bbccfabe8a28b380d12bd80 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 17 Jun 2024 10:57:17 -0500 Subject: Use the form's json attribute to retrieve sent data The system uses JSON as the default communication format, so we use the form's json attribute to get any data sent. --- gn_auth/auth/authorisation/data/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gn_auth/auth/authorisation/data') diff --git a/gn_auth/auth/authorisation/data/views.py b/gn_auth/auth/authorisation/data/views.py index 83f4e4b..86dafe5 100644 --- a/gn_auth/auth/authorisation/data/views.py +++ b/gn_auth/auth/authorisation/data/views.py @@ -186,16 +186,16 @@ def __search_mrna__(): def __request_key__(key: str, default: Any = ""): if bool(request.json): return request.json.get(#type: ignore[union-attr] - key, request.args.get(key, request.form.get(key, default))) - return request.args.get(key, request.form.get(key, default)) + key, request.args.get(key, request.json.get(key, default))) + return request.args.get(key, request.json.get(key, default)) def __request_key_list__(key: str, default: tuple[Any, ...] = tuple()): if bool(request.json): return (request.json.get(key,[])#type: ignore[union-attr] - or request.args.getlist(key) or request.form.getlist(key) + or request.args.getlist(key) or request.json.getlist(key) or list(default)) return (request.args.getlist(key) - or request.form.getlist(key) or list(default)) + or request.json.getlist(key) or list(default)) def __search_genotypes__(): query = __request_key__("query", "") -- cgit v1.2.3