diff --git a/appexemplo_v2.0/api/api_controllers/Meta_tipoAPI.class.php b/appexemplo_v2.0/api/api_controllers/Meta_tipoAPI.class.php index ea1fd4ec..d102ec24 100644 --- a/appexemplo_v2.0/api/api_controllers/Meta_tipoAPI.class.php +++ b/appexemplo_v2.0/api/api_controllers/Meta_tipoAPI.class.php @@ -31,8 +31,9 @@ public static function selectAll(Request $request, Response $response, array $ar $msg = array( 'qtd'=> \CountHelper::count($result) , 'result'=>$result ); - $response = $response->withJson($msg); - return $response; + $msgJson = json_encode($msg); + $response->getBody()->write( $msgJson ); + return $response->withHeader('Content-Type', 'application/json'); } //-------------------------------------------------------------------------------- @@ -52,8 +53,9 @@ public static function selectById(Request $request, Response $response, array $a $msg = array( 'qtd'=> \CountHelper::count($result) , 'result'=>$result ); - $response = $response->withJson($msg); - return $response; + $msgJson = json_encode($msg); + $response->getBody()->write( $msgJson ); + return $response->withHeader('Content-Type', 'application/json'); } //-------------------------------------------------------------------------------- @@ -73,8 +75,9 @@ public static function save(Request $request, Response $response, array $args) $controller = new \Meta_tipo; $controller->save($vo); - $response = $response->withJson($msg); - return $response; + $msgJson = json_encode($msg); + $response->getBody()->write( $msgJson ); + return $response->withHeader('Content-Type', 'application/json'); } //-------------------------------------------------------------------------------- @@ -83,7 +86,8 @@ public static function delete(Request $request, Response $response, array $args) $id = $args['id']; $controller = new \Meta_tipo; $msg = $controller->delete($id); - $response = $response->withJson($msg); - return $response; + $msgJson = json_encode($msg); + $response->getBody()->write( $msgJson ); + return $response->withHeader('Content-Type', 'application/json'); } } \ No newline at end of file