about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gn_auth/auth/requests.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/gn_auth/auth/requests.py b/gn_auth/auth/requests.py
index 00e9b35..e876641 100644
--- a/gn_auth/auth/requests.py
+++ b/gn_auth/auth/requests.py
@@ -1,6 +1,10 @@
 """Utilities to deal with requests."""
+import werkzeug
 from flask import request
 
 def request_json() -> dict:
     """Retrieve the JSON sent in a request."""
-    return request.json or dict(request.form) or {}
+    try:
+        return request.json
+    except werkzeug.exceptions.UnsupportedMediaType:
+        return dict(request.form) or {}