[HttpFoundation] Fix trailing space for mime-type with parameters
This commit is contained in:
parent
303cae1fec
commit
f4866bc371
@ -1326,7 +1326,7 @@ class Request
|
|||||||
{
|
{
|
||||||
$canonicalMimeType = null;
|
$canonicalMimeType = null;
|
||||||
if (false !== $pos = strpos($mimeType, ';')) {
|
if (false !== $pos = strpos($mimeType, ';')) {
|
||||||
$canonicalMimeType = substr($mimeType, 0, $pos);
|
$canonicalMimeType = trim(substr($mimeType, 0, $pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === static::$formats) {
|
if (null === static::$formats) {
|
||||||
|
@ -323,6 +323,9 @@ class RequestTest extends TestCase
|
|||||||
{
|
{
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$this->assertEquals('json', $request->getFormat('application/json; charset=utf-8'));
|
$this->assertEquals('json', $request->getFormat('application/json; charset=utf-8'));
|
||||||
|
$this->assertEquals('json', $request->getFormat('application/json;charset=utf-8'));
|
||||||
|
$this->assertEquals('json', $request->getFormat('application/json ; charset=utf-8'));
|
||||||
|
$this->assertEquals('json', $request->getFormat('application/json ;charset=utf-8'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetFormatWithCustomMimeType()
|
public function testGetFormatWithCustomMimeType()
|
||||||
|
Reference in New Issue
Block a user