diff options
| author | sebpiq | 2011-03-10 16:59:21 +0200 |
|---|---|---|
| committer | sebpiq | 2011-03-10 16:59:21 +0200 |
| commit | b117f7bd4503e74160c42b4ac1de3f8ea1132731 (patch) | |
| tree | 2300019f9e2e87a78f80cec611c43dd0141dd441 | |
| parent | 2d8e4e056b1b6f822d02d614955ee1f220e2fdda (diff) | |
| download | django-rest-framework-b117f7bd4503e74160c42b4ac1de3f8ea1132731.tar.bz2 | |
added a test
| -rw-r--r-- | djangorestframework/content.py | 2 | ||||
| -rw-r--r-- | djangorestframework/tests/content.py | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/djangorestframework/content.py b/djangorestframework/content.py index 48f327b6..f9a3c6de 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 9052f677..ee7af486 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""" |
