Skip to content

Commit

Permalink
Merge branch '1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed May 16, 2014
2 parents c19cd80 + fa1283e commit a98fb6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Negotiation/FormatNegotiator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions tests/Negotiation/Tests/FormatNegotiatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
}

Expand Down

0 comments on commit a98fb6b

Please sign in to comment.