Don't redirect the /events endpoint to login (#1132)

* Detect `text/event-stream` in `authed_only` to prevent unnecessary redirects to `/login`
bulk-clear-sessions
Kevin Chung 2019-10-11 23:18:44 -07:00 committed by GitHub
parent a9b2fe15e3
commit 6c5c63d667
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -84,7 +84,7 @@ def authed_only(f):
if authed():
return f(*args, **kwargs)
else:
if request.content_type == "application/json":
if request.content_type == "application/json" or request.accept_mimetypes.best == "text/event-stream":
abort(403)
else:
return redirect(url_for("auth.login", next=request.full_path))