Gestion du code d'erreur 200 ou 417

This commit is contained in:
xdrm-brackets 2016-06-02 22:28:45 +02:00
parent a7a4c65f85
commit 07d608fdaf
3 changed files with 9 additions and 1 deletions

View File

@ -98,7 +98,7 @@
// Api
$R->post('api/?', function(){
$R->post('api.+', function(){
$request = ModuleRequest::fromPost($_POST);
$answer = $request->dispatch();

View File

@ -117,6 +117,11 @@
return null;
}
public static function setHttpCode($error){
http_response_code( $error == self::Success ? 200 : 417 );
}
}
?>

View File

@ -136,6 +136,9 @@
*/
public function serialize(){
// Code Http
ManagerError::setHttpCode($this->error);
// On rajoute l'erreur au message
$returnData = array_merge(
array(