From c28105e4977f299bbab6f5808ba68269bfab36c1 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 16 Jul 2025 12:19:58 -0500 Subject: Bugfix: Handle possible missing json data. --- gn_auth/auth/authorisation/users/views.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'gn_auth/auth/authorisation/users/views.py') diff --git a/gn_auth/auth/authorisation/users/views.py b/gn_auth/auth/authorisation/users/views.py index 55921ca..2ad672d 100644 --- a/gn_auth/auth/authorisation/users/views.py +++ b/gn_auth/auth/authorisation/users/views.py @@ -335,15 +335,17 @@ def user_join_request_exists(): @require_oauth("profile user") def list_all_users() -> Response: """List all the users.""" - _kwargs = { - key: value - for key, value in ( - request.json.items() if request.json - else { - "email": "", "name": "", "verified": "", "age": "" - }) - if key in ("email", "name", "verified", "age") - } + _kwargs = ( + { + key: value + for key, value in request_json().items() + if key in ("email", "name", "verified", "age") + } + or + { + "email": "", "name": "", "verified": "", "age": "" + } + ) with (require_oauth.acquire("profile group") as _the_token, db.connection(current_app.config["AUTH_DB"]) as conn, -- cgit v1.2.3