protected function cors($verb = 'GET')
{
if (isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: *");
}
if ($this->verb == 'GET' || $this->verb == 'OPTIONS') {
header("Access-Control-Expose-Headers: content-type, content-range, accept-range");
}
if ($this->verb == "OPTIONS") {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) {
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS");
}
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
header("Access-Control-Allow-Headers: " . "origin, content-type, accept, session-token, authorization");
}
exit(0);
}
}