diff --git a/index.php b/index.php index f857c40..3f4dc7b 100755 --- a/index.php +++ b/index.php @@ -98,7 +98,7 @@ // Api - $R->post('api/?', function(){ + $R->post('api.+', function(){ $request = ModuleRequest::fromPost($_POST); $answer = $request->dispatch(); diff --git a/manager/ManagerError.php b/manager/ManagerError.php index a92d335..d6a5994 100755 --- a/manager/ManagerError.php +++ b/manager/ManagerError.php @@ -117,6 +117,11 @@ return null; } + + public static function setHttpCode($error){ + http_response_code( $error == self::Success ? 200 : 417 ); + } + } ?> diff --git a/manager/ModuleResponse.php b/manager/ModuleResponse.php index f908d01..0c45e4e 100755 --- a/manager/ModuleResponse.php +++ b/manager/ModuleResponse.php @@ -136,6 +136,9 @@ */ public function serialize(){ + // Code Http + ManagerError::setHttpCode($this->error); + // On rajoute l'erreur au message $returnData = array_merge( array(