Barebone setup@3 > upd: routes.json (enable VIEW http method) | fix: api.Request

This commit is contained in:
xdrm-brackets 2017-11-23 12:56:07 +01:00
parent cc4fd4427b
commit a6cfd218d6
2 changed files with 6 additions and 6 deletions

View File

@ -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);
}

View File

@ -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_]+",