diff --git a/build/api/core/Request.php b/build/api/core/Request.php index 3952d56..d263846 100755 --- a/build/api/core/Request.php +++ b/build/api/core/Request.php @@ -192,7 +192,7 @@ /* [3] On verifie que la methode est amorcable =========================================================*/ if( !is_callable([$instance, $this->getModuleMethod()]) ){ - $this->error->set(Err::UncallableMethod, preg_replace('/\w+::/i', '', $this->path['method']) ); + $this->error->set(Err::UncallableMethod, preg_replace('/[A-Z]+ /i', '', $this->path['method']) ); return new Response($this->error); } @@ -234,15 +234,15 @@ =========================================================*/ $instance = ModuleFactory::getModule($this->path['module']); - if( $instance === false ){ - $this->error->set(Err::UncallableModule); + if( $instance instanceof Error ){ + $this->error->set(Err::UncallableModule, $this->path['module']); return new Response($this->error); } /* [3] On verifie que la methode est amorcable =========================================================*/ if( !is_callable([$instance, $this->getModuleMethod()]) ){ - $this->error->set(Err::UncallableMethod); + $this->error->set(Err::UncallableMethod, preg_replace('/[A-Z]+ /i', '', $this->path['method']) ); return new Response($this->error); } diff --git a/config/routes.json b/config/routes.json index c1538f2..ed0596c 100755 --- a/config/routes.json +++ b/config/routes.json @@ -1,6 +1,6 @@ { - "methods": [ "GET", "POST", "PUT", "DELETE" ], + "methods": [ "GET", "POST", "PUT", "DELETE", "VIEW" ], "routes": { @@ -14,7 +14,7 @@ }, "/api/v/1.0/{module}/{method}{uri_args}": { - "methods": ["GET", "POST", "PUT", "DELETE"], + "methods": ["GET", "POST", "PUT", "DELETE", "VIEW"], "controller": "api:call", "arguments": { "module": "[a-zA-Z_]+",