hydra passwordless
This commit is contained in:
@ -19,12 +19,25 @@ class ApiService
|
||||
return \Unirest\Request\Body::json($array);
|
||||
}
|
||||
|
||||
public function run($method,$url,$query,$header=null) {
|
||||
public function run($method,$url,$query,$header=null,$content="json") {
|
||||
// Entete
|
||||
$headerini = [
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
];
|
||||
switch($content) {
|
||||
case "json":
|
||||
$headerini = [
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json',
|
||||
];
|
||||
if($query) $query = \Unirest\Request\Body::json($query);
|
||||
break;
|
||||
|
||||
case "form":
|
||||
$headerini = [
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/x-www-form-urlencoded',
|
||||
];
|
||||
if($query) $query = \Unirest\Request\Body::form($query);
|
||||
break;
|
||||
}
|
||||
|
||||
if($header) $header=array_merge($headerini,$header);
|
||||
else $header=$headerini;
|
||||
@ -42,9 +55,6 @@ class ApiService
|
||||
\Unirest\Request::proxy($proxyHost, $proxyPort, CURLPROXY_HTTP, true);
|
||||
}
|
||||
|
||||
//if($query) $query = \Unirest\Request\Body::json($query);
|
||||
if($query) $query = http_build_query($query);
|
||||
|
||||
$response = false;
|
||||
switch($method) {
|
||||
case "POST":
|
||||
|
Reference in New Issue
Block a user