Adding "Cross Domain AJAX" requests support for API Dispatcher
This commit is contained in:
@@ -1083,6 +1083,23 @@ class Bootstrap
|
|||||||
*/
|
*/
|
||||||
public function dispatchApiService($uri, $version = '1.0')
|
public function dispatchApiService($uri, $version = '1.0')
|
||||||
{
|
{
|
||||||
|
// to handle a request with "OPTIONS" method
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
|
||||||
|
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS, HEADERS');
|
||||||
|
header('Access-Control-Allow-Headers: authorization, content-type');
|
||||||
|
header("Access-Control-Allow-Credentials", "false");
|
||||||
|
header('Access-Control-Max-Age: 60');
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enable this header to allow "Cross Domain AJAX" requests;
|
||||||
|
* This works because processmaker is handling correctly requests with method 'OPTIONS'
|
||||||
|
* that automatically is sent by a client using XmlHttpRequest or similar.
|
||||||
|
*/
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $servicesDir contains directory where Services Classes are allocated
|
* $servicesDir contains directory where Services Classes are allocated
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2609,7 +2609,7 @@ class G
|
|||||||
* @param integer $permission
|
* @param integer $permission
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function uploadFile ($file, $path, $nameToSave, $permission = 0660)
|
public static function uploadFile ($file, $path, $nameToSave, $permission = 0660)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($file == '') {
|
if ($file == '') {
|
||||||
|
|||||||
Reference in New Issue
Block a user