Straightforward question, I am using DRF with a class-based view to serve up an API for consumption by Angular. In particular, I want to respond to a GET request with JSON data that Angular can subscribe to:
class AuditListAPIView(generics.ListAPIView):
queryset = Audit.objects.all()
serializer_class = AuditSerializer
filter_backends = (filters.DjangoFilterBackend,)
filterset_class = AuditFilter
renderer_classes = (JSONRenderer,)
The problem is that the content type for the response is "text/html" instead of "application/json". For example:
> curl -s -I <host>:8000 | grep "^Content-Type:"
Content-Type: text/html
Can anyone explain why this is so, and how to address this?