Skip to content

Commit 4abc1fa

Browse files
committed
Session stale token workaround
Session requires fields be present even for an error response, which feels wrong, but is required to get current Session to properly request a new token.
1 parent bf7974f commit 4abc1fa

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

sogs/legacy_routes.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,15 @@ def handle_comapct_poll():
214214
try:
215215
r = handle_one_compact_poll(req)
216216
except HTTPException as e:
217-
r = {'status_code': e.get_response().status_code, 'results': []}
217+
# Hack for Session: if there isn't a full fleshed out response then Session just ignores
218+
# the response (even when it's an error response), so we send this fake response:
219+
r = {
220+
'status_code': e.get_response().status_code,
221+
'room_id': req.get('room_id', ''),
222+
'messages': [],
223+
'deletions': [],
224+
'moderators': [],
225+
}
218226
result.append(r)
219227

220228
return jsonify({'status_code': 200, 'results': result})

0 commit comments

Comments
 (0)