Commits

zyegfryed  committed 4522935

Fixed AssertionError raised by MimeAccept best_macth function when
using wildcard Accept header.

  • Participants
  • Parent commits 5a8564a

Comments (0)

Files changed (2)

File tests/test_acceptparse.py

     assert not mimeaccept._match('text/html', 'image/jpg')
     assert_raises(ValueError, mimeaccept._match, 'image/jpg', '*/*')
 
+def test_accept_json():
+    mimeaccept = MIMEAccept('Accept', 'text/html, *; q=.2, */*; q=.2')
+    assert mimeaccept.best_match(['application/json']) == 'application/json'
 
 # property tests
 

File webob/acceptparse.py

                 continue
             parsed.append((mask, q))
         self._parsed = parsed
+        self._parsed_nonzero = [(m,q) for (m,q) in self._parsed if q]
 
     def accept_html(self):
         """