diff --git a/src/Negotiation/FormatNegotiator.php b/src/Negotiation/FormatNegotiator.php index 5e74e51..65b044b 100644 --- a/src/Negotiation/FormatNegotiator.php +++ b/src/Negotiation/FormatNegotiator.php @@ -86,7 +86,9 @@ public function getBestFormat($acceptHeader, array $priorities = array()) $mimeTypes = $this->normalizePriorities($priorities); if (null !== $accept = $this->getBest($acceptHeader, $mimeTypes)) { - if (null !== $format = $this->getFormat($accept->getValue())) { + if (0.0 < $accept->getQuality() && + null !== $format = $this->getFormat($accept->getValue()) + ) { if (in_array($format, $priorities) || $this->isCatchAllEnabled($priorities)) { return $format; } diff --git a/tests/Negotiation/Tests/FormatNegotiatorTest.php b/tests/Negotiation/Tests/FormatNegotiatorTest.php index 4238cac..578934f 100644 --- a/tests/Negotiation/Tests/FormatNegotiatorTest.php +++ b/tests/Negotiation/Tests/FormatNegotiatorTest.php @@ -254,6 +254,7 @@ public static function dataProviderForGetBestFormat() array('text/html,application/xhtml+xml,application/xml', array('json'), null), array('text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c', array('*/*'), 'html'), array('text/html, application/json;q=0.8, text/csv;q=0.7', array(), 'html'), + array('text/html; q=0.0', array(), null), ); }