chg: [internal] moved socket / request creation to appmodel

pull/3530/head
iglocska 2018-08-03 11:52:20 +02:00
parent 00eca6d299
commit 985da9d3a9
1 changed files with 23 additions and 0 deletions

View File

@ -1585,4 +1585,27 @@ class AppModel extends Model
}
return true;
}
public function setupHttpSocket($server, $HttpSocket = null)
{
if (empty($HttpSocket)) {
App::uses('SyncTool', 'Tools');
$syncTool = new SyncTool();
$HttpSocket = $syncTool->setupHttpSocket($server);
}
return $HttpSocket;
}
public function setupSyncRequest($server)
{
$request = array(
'header' => array(
'Authorization' => $server['Server']['authkey'],
'Accept' => 'application/json',
'Content-Type' => 'application/json'
)
);
$request = $this->addHeaders($request);
return $request;
}
}