Skip to content

Commit

Permalink
🐛 #118 TGenericAPI com status
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Sep 27, 2022
1 parent 4098b14 commit abecfbc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions system_skeleton/rest/api/api_controllers/TGenericAPI.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ class TGenericAPI
public function __construct()
{
}

public static function getBodyJson($msg, Response $response)
public static function getBodyJson($msg, Response $response,$status=200)
{
$msgJson = json_encode($msg);
$status = empty($status)?200:$status;
$msgJson = json_encode($msg, JSON_UNESCAPED_UNICODE);
$response->withHeader('Content-Type', 'application/json');
$response->getBody()->write( $msgJson );
return $response->withHeader('Content-Type', 'application/json');
return $response->withStatus( $status );
}
public static function getSelectNumPage($args)
{
Expand All @@ -26,5 +27,5 @@ public static function getSelectNumRowsPerPage($args)
$rowsPerPage = \ArrayHelper::get($args,'rowsPerPage');
$rowsPerPage = empty($page)?ROWS_PER_PAGE:$rowsPerPage;
return $rowsPerPage;
}
}
}

0 comments on commit abecfbc

Please sign in to comment.