coverage: Add test for REST requests to /json API unauthed.

This commit is contained in:
Tim Abbott
2017-03-05 00:39:36 -08:00
parent c8e38aaa55
commit 2f8bb1b1cd
2 changed files with 8 additions and 0 deletions

View File

@@ -104,6 +104,7 @@ def rest_dispatch(request, **kwargs):
# If this looks like a request from a top-level page in a
# browser, send the user to the login page
if 'text/html' in request.META.get('HTTP_ACCEPT', ''):
# TODO: It seems like the `?next=` part is unlikely to be helpful
return HttpResponseRedirect('%s/?next=%s' % (settings.HOME_NOT_LOGGED_IN, request.path))
# Ask for basic auth (email:apiKey)
elif request.path.startswith("/api"):