willdurand / Negotiation

Content Negotiation tools for PHP.
https://williamdurand.fr/Negotiation/
MIT License
1.41k stars 62 forks source link

Support */* for EncodingNegotiator #105

Open TiMESPLiNTER opened 4 years ago

TiMESPLiNTER commented 4 years ago

Currently passing in an accept header equals */* does not work. It tells that there's no match and EncodingNegotiator::getBest() returns null instead it should return the highest prioritized available content type.

$negotiator = new EncodingNegotiator();
$mediaType = $negotiator->getBest('*/*', ['application/json']);
var_dump($mediaType); // -> null, but should be 'application/json'
willdurand commented 2 years ago

Hey, could you please write a test case and submit a PR to start a conversation around this issue? Thanks!