From a346bc628589bfa3d0305d30df150def1611ae86 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Wed, 21 Apr 2021 15:15:02 +0200 Subject: [PATCH] JSON of course return json, but also normal web requests --- ivatar/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ivatar/views.py b/ivatar/views.py index d3de012..57f21f0 100644 --- a/ivatar/views.py +++ b/ivatar/views.py @@ -411,7 +411,8 @@ class StatsView(TemplateView, JsonResponse): 'openids': ConfirmedOpenId.objects.all().count(), # pylint: disable=no-member } - if request.content_type == 'application/json': + # JSON of course return json, but also normal web requests default to JSON + if request.content_type == 'application/json' or request.content_type == 'text/plain': return JsonResponse(retval) return HttpResponseRedirect(reverse_lazy('home'))