Request: Introduce method extractMediaType

refs #3484
This commit is contained in:
Johannes Meyer 2018-06-27 10:26:22 +02:00 committed by Eric Lippmann
parent 10fa64b7e3
commit 842e5603a1
1 changed files with 14 additions and 0 deletions

View File

@ -128,4 +128,18 @@ class Request extends Zend_Controller_Request_Http
? Json::decode(file_get_contents('php://input'), true)
: parent::getPost($key, $default);
}
/**
* Extract and return the media type from the given header value
*
* @param string $headerValue
*
* @return string
*/
protected function extractMediaType($headerValue)
{
// Pretty basic and does not care about parameters
$parts = explode(';', $headerValue, 2);
return strtolower(trim($parts[0]));
}
}