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
c72a20c4
Commit
c72a20c4
authored
Nov 29, 2012
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #452 from fabianbuechler/patch-1
Renderer negotiation: media_type specificty evaluation weak
parents
968f4a5c
731443b7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletions
+3
-1
rest_framework/negotiation.py
+3
-1
No files found.
rest_framework/negotiation.py
View file @
c72a20c4
...
...
@@ -2,6 +2,7 @@ from django.http import Http404
from
rest_framework
import
exceptions
from
rest_framework.settings
import
api_settings
from
rest_framework.utils.mediatypes
import
order_by_precedence
,
media_type_matches
from
rest_framework.utils.mediatypes
import
_MediaType
class
BaseContentNegotiation
(
object
):
...
...
@@ -48,7 +49,8 @@ class DefaultContentNegotiation(BaseContentNegotiation):
for
media_type
in
media_type_set
:
if
media_type_matches
(
renderer
.
media_type
,
media_type
):
# Return the most specific media type as accepted.
if
len
(
renderer
.
media_type
)
>
len
(
media_type
):
if
(
_MediaType
(
renderer
.
media_type
)
.
precedence
>
_MediaType
(
media_type
)
.
precedence
):
# Eg client requests '*/*'
# Accepted media type is 'application/json'
return
renderer
,
renderer
.
media_type
...
...
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