Wrong "best_math" for Accept-* header
Issue #10
resolved
According to RFC: "If a parameter has a quality value of 0, then content with this parameter is `not acceptable' for the client." but unfortunately acceptparse.Accept does not conform that rule :(
Eg.:
Accept( 'Accept-Encoding', 'deflate, *;q=0' ).best_match( ['foo'] )
Returns "foo" instead of default value.
Comments (6)
-
-
Hope it will be sufficient :-)
<pre>
- !/usr/bin/env python
- -*- coding: utf-8 -*- from webob.acceptparse import Accept
if 'main' == name: assert Accept('Accept-Encoding', 'bar, *;q=0').best_match( [ 'foo' ], 'baz' ) == 'baz' </pre>
-
- attached test_quality.py
I attached test case - unfortunalely putting code into comments is not a goot idea ;-)
-
You can wrap code like this:
{{{code}}}
There's a button in the comment form for that too. -
- changed status to open
-
assigned issue to
-
- Log in to comment
Provide a test case.