Fix testrunner content negotiation failures on Django 1.8.5

This commit is contained in:
Arkadiusz Bienert 2015-11-09 14:18:21 +01:00
parent 944a1711ec
commit 52cb38b8c7

View File

@ -93,5 +93,12 @@ class DefaultContentNegotiation(BaseContentNegotiation):
Given the incoming request, return a tokenised list of media Given the incoming request, return a tokenised list of media
type strings. type strings.
""" """
header = request.META.get('HTTP_ACCEPT', '*/*') header = request.META.get('HTTP_ACCEPT')
if not header:
if 'headers' in request.META.keys():
header = request.META['headers'].get('Accept', '*/*')
else:
header = '*/*'
header = request.query_params.get(self.settings.URL_ACCEPT_OVERRIDE, header)
return [token.strip() for token in header.split(',')] return [token.strip() for token in header.split(',')]