diff --git a/src/Negotiation/FormatNegotiator.php b/src/Negotiation/FormatNegotiator.php index a69917e..4fc68ae 100644 --- a/src/Negotiation/FormatNegotiator.php +++ b/src/Negotiation/FormatNegotiator.php @@ -103,7 +103,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 7c896b4..d637588 100644 --- a/tests/Negotiation/Tests/FormatNegotiatorTest.php +++ b/tests/Negotiation/Tests/FormatNegotiatorTest.php @@ -310,6 +310,7 @@ public static function dataProviderForGetBestFormat() array('text/html, application/json;q=0.8, text/csv;q=0.7', array(), 'html'), array('text/html', array('text/xml'), null), array('text/*, text/html, text/html;level=1, */*', array(), 'html'), + array('text/html; q=0.0', array(), null), ); }