Files
bugsink/ingest/negotiation.py
2023-11-03 19:56:36 +01:00

21 lines
835 B
Python

from rest_framework.negotiation import BaseContentNegotiation
class IgnoreClientContentNegotiation(BaseContentNegotiation):
# Sentry clients do not always send the correct Accept headers but expect json anyway.
# Proceed as per https://www.django-rest-framework.org/api-guide/content-negotiation/#example
def select_parser(self, request, parsers):
"""
Select the first parser in the `.parser_classes` list.
"""
# TODO double-check and write down why this is the correct thing
return parsers[0]
def select_renderer(self, request, renderers, format_suffix):
"""
Select the first renderer in the `.renderer_classes` list.
"""
# TODO double-check and write down why this is the correct thing
return (renderers[0], renderers[0].media_type)