Django JsonResponse returning content-type text/html instead of application/json Django JsonResponse returning content-type text/html instead of application/json json json

Django JsonResponse returning content-type text/html instead of application/json


It appears that

self.client.get('/api/list')

led to an error-page (hence the text/html content_type).

EDIT: Not an error-page, but an http-redirect, according to LudwikTrammer.

Changing

self.client.get('/api/list') 

to

self.client.get('/api/list/') 

solved the issue.