Skip to content

Commit bdeaf6b

Browse files
committed
Produce a useful warning/error if client feeds us garbage
1 parent 2742147 commit bdeaf6b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sogs/routes/users.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def extract_rooms_or_global(req, admin=True):
2727
to).
2828
"""
2929

30+
if not isinstance(req, dict):
31+
app.logger.warning(f"Invalid request: expected a JSON object body, not {type(req)}")
32+
abort(http.BAD_REQUEST)
33+
3034
room_tokens, global_ = req.get('rooms'), req.get('global', False)
3135

3236
if room_tokens and not isinstance(room_tokens, list):

0 commit comments

Comments
 (0)