You've already forked Php-Template
feat: implement GenericResponse class and update controllers to use it for consistent JSON responses
All checks were successful
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m51s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m56s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m50s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m52s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 3m1s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m21s
All checks were successful
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m51s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m56s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m50s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m52s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 3m1s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m21s
This commit is contained in:
@@ -37,7 +37,7 @@ class IndexController extends Controller
|
||||
#[UnauthorizedResponse]
|
||||
public function get(ServerRequest $request): ResponseInterface
|
||||
{
|
||||
return JsonResponseFactory::createJsonResponse(['message' => 'Server is running']);
|
||||
return JsonResponseFactory::createJsonResponse(new GenericResponse('Server is running'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,4 +16,4 @@ class TokenSecurity extends OA\SecurityScheme
|
||||
scheme: 'bearer'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class IndexControllerTest extends AbstractController
|
||||
$response = $controller->get($this->getMockRequest());
|
||||
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$this->assertEquals('{"status_code":200,"message":"Server is running"}', (string)$response->getBody());
|
||||
$this->assertEquals('{"message":"Server is running","status_code":200}', (string)$response->getBody());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,6 +35,6 @@ class IndexControllerTest extends AbstractController
|
||||
$response = $controller->post($this->getMockRequest());
|
||||
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$this->assertEquals('{"status_code":200,"message":"Server is running"}', (string)$response->getBody());
|
||||
$this->assertEquals('{"message":"POST request received","status_code":200}', (string)$response->getBody());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user