Skip to content

Commit

Permalink
Revert "Add $strict parameter to getBest() to enable exceptions f…
Browse files Browse the repository at this point in the history
…or invalid media types."

This reverts commit 56f51ee.
  • Loading branch information
willdurand committed Oct 14, 2016
1 parent 348c740 commit 1f210db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
6 changes: 2 additions & 4 deletions src/Negotiation/AbstractNegotiator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract class AbstractNegotiator
*
* @return AcceptHeader|null best matching type
*/
public function getBest($header, array $priorities, $strict = false)
public function getBest($header, array $priorities)
{
if (empty($priorities)) {
throw new InvalidArgument('A set of server priorities should be given.');
Expand All @@ -33,9 +33,7 @@ public function getBest($header, array $priorities, $strict = false)
try {
$acceptedHeaders[] = $this->acceptFactory($h);
} catch (Exception\Exception $e) {
if ($strict) {
throw $e;
}
// silently skip in case of invalid headers coming in from a client
}
}
$acceptedPriorities = array();
Expand Down
11 changes: 0 additions & 11 deletions tests/Negotiation/Tests/NegotiatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,6 @@ public function testGetBestRespectsQualityOfSource()
$this->assertEquals('text/plain', $accept->getType());
}

/**
* @expectedException Negotiation\Exception\InvalidMediaType
*/
public function testGetBestInvalidMediaType()
{
$header = 'sdlfkj20ff; wdf';
$priorities = array('foo/qwer');

$this->negotiator->getBest($header, $priorities, true);
}

/**
* @dataProvider dataProviderForTestParseHeader
*/
Expand Down

0 comments on commit 1f210db

Please sign in to comment.