Change the method param to an args in URL
continuous-integration/drone/push Build is passing Details

master
dorian.hodin 2 years ago
parent f62015ebdb
commit 851fb8d72a

@ -10,7 +10,7 @@ class TypeErrorMethod extends HttpSpecializedException {
protected $code = 400; protected $code = 400;
protected string $title = "Method is not specified"; protected string $title = "Method is not specified";
protected $message = "Bad Parameters, The API need a 'method' args in URL. Exemple :'http://url/method=getSomething'"; protected $message = "Bad Parameters, The API need a 'method' args in URL. Exemple :'http://url/api/getSomething'";
public function __construct(ServerRequestInterface $request,?Throwable $previous = null) public function __construct(ServerRequestInterface $request,?Throwable $previous = null)
{ {

@ -34,7 +34,7 @@ $app->get('/', function (Request $request, Response $response){
throw new TypeErrorMethod($request); throw new TypeErrorMethod($request);
}); });
$app->get('/{method}', function (Request $request, Response $response, array $args) { $app->get('/api/{method}', function (Request $request, Response $response, array $args) {
$parameters = $request->getQueryParams(); $parameters = $request->getQueryParams();
$method = $args['method']; $method = $args['method'];
$listGateway = array("\\Gateway\\GatewayForm", "\\Gateway\\GatewayKeyword", "\\Gateway\\GatewayQuestion"); $listGateway = array("\\Gateway\\GatewayForm", "\\Gateway\\GatewayKeyword", "\\Gateway\\GatewayQuestion");

Loading…
Cancel
Save