Skip to content

Commit 00e5065

Browse files
authored
Raise NotAcceptable if suffix or query format is not acceptable
1 parent b31413d commit 00e5065

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

rest_framework/negotiation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Content negotiation deals with selecting an appropriate renderer given the
33
incoming request. Typically this will be based on the request's Accept header.
44
"""
5-
from django.http import Http404
65

76
from rest_framework import exceptions
87
from rest_framework.settings import api_settings
@@ -85,7 +84,10 @@ def filter_renderers(self, renderers, format):
8584
renderers = [renderer for renderer in renderers
8685
if renderer.format == format]
8786
if not renderers:
88-
raise Http404
87+
raise exceptions.NotAcceptable(
88+
detail="Could not satisfy the request format suffix or query.",
89+
available_renderers=renderers
90+
)
8991
return renderers
9092

9193
def get_accept_list(self, request):

0 commit comments

Comments
 (0)