Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
b117f7bd
Commit
b117f7bd
authored
Mar 10, 2011
by
sebpiq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added a test
parent
2d8e4e05
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
1 deletions
+2
-1
djangorestframework/content.py
+1
-1
djangorestframework/tests/content.py
+1
-0
No files found.
djangorestframework/content.py
View file @
b117f7bd
...
@@ -40,7 +40,7 @@ class OverloadedContentMixin(ContentMixin):
...
@@ -40,7 +40,7 @@ class OverloadedContentMixin(ContentMixin):
"""If the request contains content, returns a tuple of (content_type, content) otherwise returns None.
"""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."""
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
):
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
)
content_type
=
request
.
META
.
get
(
'CONTENT_TYPE'
,
None
)
if
(
request
.
method
==
'POST'
and
self
.
CONTENT_PARAM
and
if
(
request
.
method
==
'POST'
and
self
.
CONTENT_PARAM
and
...
...
djangorestframework/tests/content.py
View file @
b117f7bd
...
@@ -111,6 +111,7 @@ class TestContentMixins(TestCase):
...
@@ -111,6 +111,7 @@ class TestContentMixins(TestCase):
OverloadedContentMixin
.
CONTENTTYPE_PARAM
:
content_type
}
OverloadedContentMixin
.
CONTENTTYPE_PARAM
:
content_type
}
request
=
self
.
req
.
post
(
'/'
,
form_data
)
request
=
self
.
req
.
post
(
'/'
,
form_data
)
self
.
assertEqual
(
OverloadedContentMixin
()
.
determine_content
(
request
),
(
content_type
,
content
))
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
):
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"""
"""Ensure determine_content(request) returns (None, content) for overloaded POST request with content type not set"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment