getBody()->write(json_encode($data)); return $response->withStatus($statusCode)->withHeader('Content-Type', 'application/json'); } }