public function setContentType(string
$mime, string
$charset = 'UTF-8'
) { // add charset attribute if not already there and provided as parm
if ((strpos($mime, 'charset='
) < 1
) && !
empty($charset)) { $mime .= '; charset=' .
$charset;
} $this->
removeHeader('Content-Type'
); // replace existing content type
$this->
setHeader('Content-Type',
$mime);
return $this;
} /**
* Converts the $body into JSON and sets the Content Type header.
*
* @param array|object|string $body
*
* @return $this
*/