From 9d02ee212cedf53bf4162ef6053eb9cc58f33d6b Mon Sep 17 00:00:00 2001 From: "dorian.hodin" Date: Tue, 28 Feb 2023 10:18:58 +0100 Subject: [PATCH] TEMP : try to return an array to make the Json Conversion --- Source/API/script/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/API/script/index.php b/Source/API/script/index.php index 927103e..5d58dea 100644 --- a/Source/API/script/index.php +++ b/Source/API/script/index.php @@ -29,16 +29,16 @@ try{ $parameters = $request->getQueryParams(); $method = $parameters['method']; unset($parameters['method']); - $response->getBody()->write($method); $listGateway = array("\\Gateway\\GatewayForm", "\\Gateway\\GatewayKeyword", "\\Gateway\\GatewayQuestion"); foreach ($listGateway as $gateway) // Pour chaque Gateway { if (method_exists($gateway, $method)) { - $response->getBody()->write((new $gateway)->$method($parameters)); // Si oui, on appelle cette fonction + //$response->getBody()->write(print_r((new $gateway)->$method($parameters))); // Si oui, on appelle cette fonction + $response->getBody()->write(print_r(array('response' => "Rien", 'test' => "Test Ici"))); } } - return $response; - //return $response->withHeader('Content-type', 'application/json'); + //return $response; + return $response->withHeader('Content-type', 'application/json'); }); }catch (TypeError $t){ echo "Error, wrong parameters key, or no parameters write : ".$t->getMessage();