diff --git a/src/Negotiation/FormatNegotiator.php b/src/Negotiation/FormatNegotiator.php index 4147b6c..352ba4e 100644 --- a/src/Negotiation/FormatNegotiator.php +++ b/src/Negotiation/FormatNegotiator.php @@ -87,7 +87,9 @@ public function getBestFormat($acceptHeader, array $priorities = array()) $catchAllEnabled = $this->isCatchAllEnabled($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) || $catchAllEnabled) { return $format; } diff --git a/tests/Negotiation/Tests/FormatNegotiatorTest.php b/tests/Negotiation/Tests/FormatNegotiatorTest.php index 762cf69..7750716 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), ); }