hydra passwordless

This commit is contained in:
2022-08-26 15:13:22 +02:00
parent 7962e2ca9a
commit 21fb28a6f0
8 changed files with 262 additions and 63 deletions

View File

@ -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":