diff --git a/djangorestframework/content.py b/djangorestframework/content.py index 48f327b6f..f9a3c6de6 100644 --- a/djangorestframework/content.py +++ b/djangorestframework/content.py @@ -40,7 +40,7 @@ class OverloadedContentMixin(ContentMixin): """If the request contains content, returns a tuple of (content_type, content) otherwise returns None. Note that content_type may be None if it is unset.""" if not request.META.get('CONTENT_LENGTH', None) and not request.META.get('TRANSFER_ENCODING', None): - return None # TODO : Breaks, because determine_content should return a tuple. + return None content_type = request.META.get('CONTENT_TYPE', None) if (request.method == 'POST' and self.CONTENT_PARAM and diff --git a/djangorestframework/tests/content.py b/djangorestframework/tests/content.py index 9052f677e..ee7af486d 100644 --- a/djangorestframework/tests/content.py +++ b/djangorestframework/tests/content.py @@ -111,6 +111,7 @@ class TestContentMixins(TestCase): OverloadedContentMixin.CONTENTTYPE_PARAM: content_type} request = self.req.post('/', form_data) self.assertEqual(OverloadedContentMixin().determine_content(request), (content_type, content)) + self.assertEqual(request.META['CONTENT_TYPE'], content_type) def test_overloaded_behaviour_allows_content_tunnelling_content_type_not_set(self): """Ensure determine_content(request) returns (None, content) for overloaded POST request with content type not set"""