#36411: get_preferred_type ignores params
-------------------------------+--------------------------------------
Reporter: magicfelix | Owner: (none)
Type: Bug | Status: new
Component: HTTP handling | Version: 5.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by Sarah Boyce):
Looking at the Accept header in
https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2, there are
some examples including parameters:
{{{
Media ranges can be overridden by more specific media ranges or
specific media types. If more than one media range applies to a
given type, the most specific reference has precedence. For example,
Accept: text/*, text/plain, text/plain;format=flowed, */*
have the following precedence:
1. text/plain;format=flowed
2. text/plain
3. text/*
4. */*
The media type quality factor associated with a given type is
determined by finding the media range with the highest precedence
that matches the type. For example,
Accept: text/*;q=0.3, text/html;q=0.7, text/html;level=1,
text/html;level=2;q=0.4, */*;q=0.5
would cause the following values to be associated:
+-------------------+---------------+
| Media Type | Quality Value |
+-------------------+---------------+
| text/html;level=1 | 1 |
| text/html | 0.7 |
| text/plain | 0.3 |
| image/jpeg | 0.5 |
| text/html;level=2 | 0.4 |
| text/html;level=3 | 0.7 |
+-------------------+---------------+
}}}
So I think we probably should take into account parameters but open to
hearing other opinions
--
Ticket URL: <
https://code.djangoproject.com/ticket/36411#comment:4>