Skip to content

Commit

Permalink
Merge branch '1.0' into 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed May 16, 2014
2 parents a9f4fbc + 94733e9 commit 2f4d964
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 @@ -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;
}
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 @@ -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),
);
}

Expand Down

0 comments on commit 2f4d964

Please sign in to comment.