Prado\Web\THttpRequest::getContentType PHP Method

getContentType() public method

public getContentType ( boolean $mimetypeOnly = true ) : string
$mimetypeOnly boolean whether to return only the mimetype (default: true)
return string content type (e.g. 'application/json' or 'text/html; encoding=gzip') or null if not specified
    public function getContentType($mimetypeOnly = true)
    {
        if (!isset($_SERVER['CONTENT_TYPE'])) {
            return null;
        }
        if ($mimetypeOnly === true && ($_pos = strpos(';', $_SERVER['CONTENT_TYPE'])) !== false) {
            return substr($_SERVER['CONTENT_TYPE'], 0, $_pos);
        }
        return $_SERVER['CONTENT_TYPE'];
    }