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
47f5bd48
Commit
47f5bd48
authored
Jan 17, 2014
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1361 from ross/x_method_override
always obey X-HTTP-METHOD-OVERRIDE header
parents
92fe7560
58d77c11
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
rest_framework/request.py
+3
-4
rest_framework/tests/test_request.py
+3
-0
No files found.
rest_framework/request.py
View file @
47f5bd48
...
...
@@ -279,10 +279,9 @@ class Request(object):
if
not
_hasattr
(
self
,
'_method'
):
self
.
_method
=
self
.
_request
.
method
if
self
.
_method
==
'POST'
:
# Allow X-HTTP-METHOD-OVERRIDE header
self
.
_method
=
self
.
META
.
get
(
'HTTP_X_HTTP_METHOD_OVERRIDE'
,
self
.
_method
)
# Allow X-HTTP-METHOD-OVERRIDE header
self
.
_method
=
self
.
META
.
get
(
'HTTP_X_HTTP_METHOD_OVERRIDE'
,
self
.
_method
)
def
_load_stream
(
self
):
"""
...
...
rest_framework/tests/test_request.py
View file @
47f5bd48
...
...
@@ -68,6 +68,9 @@ class TestMethodOverloading(TestCase):
request
=
Request
(
factory
.
post
(
'/'
,
{
'foo'
:
'bar'
},
HTTP_X_HTTP_METHOD_OVERRIDE
=
'DELETE'
))
self
.
assertEqual
(
request
.
method
,
'DELETE'
)
request
=
Request
(
factory
.
get
(
'/'
,
{
'foo'
:
'bar'
},
HTTP_X_HTTP_METHOD_OVERRIDE
=
'DELETE'
))
self
.
assertEqual
(
request
.
method
,
'DELETE'
)
class
TestContentParsing
(
TestCase
):
def
test_standard_behaviour_determines_no_content_GET
(
self
):
...
...
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