DC-001: Fix 4 failing services.routes tests - add /services/ prefix to credential routes
The 3 credential endpoints (POST/DELETE/GET /:serviceId/credentials) were missing the /services/ path segment, causing 404s when tests called /api/services/<id>/credentials. Fixed routes now match the URL pattern used by the live frontend (/api/v1/services/<id>/credentials) and the test suite. All 759 tests pass.
This commit is contained in:
@@ -197,7 +197,7 @@ module.exports = function({
|
|||||||
// ===== SERVICE CREDENTIAL ENDPOINTS =====
|
// ===== SERVICE CREDENTIAL ENDPOINTS =====
|
||||||
|
|
||||||
// Store credentials for a service
|
// Store credentials for a service
|
||||||
router.post('/:serviceId/credentials', asyncHandler(async (req, res) => {
|
router.post('/services/:serviceId/credentials', asyncHandler(async (req, res) => {
|
||||||
const { serviceId } = req.params;
|
const { serviceId } = req.params;
|
||||||
|
|
||||||
// Validate serviceId to prevent path traversal in credential keys
|
// Validate serviceId to prevent path traversal in credential keys
|
||||||
@@ -221,7 +221,7 @@ module.exports = function({
|
|||||||
}, 'store-service-creds'));
|
}, 'store-service-creds'));
|
||||||
|
|
||||||
// Delete credentials for a service
|
// Delete credentials for a service
|
||||||
router.delete('/:serviceId/credentials', asyncHandler(async (req, res) => {
|
router.delete('/services/:serviceId/credentials', asyncHandler(async (req, res) => {
|
||||||
const { serviceId } = req.params;
|
const { serviceId } = req.params;
|
||||||
|
|
||||||
// Validate serviceId to prevent path traversal in credential keys
|
// Validate serviceId to prevent path traversal in credential keys
|
||||||
@@ -236,7 +236,7 @@ module.exports = function({
|
|||||||
}, 'delete-service-creds'));
|
}, 'delete-service-creds'));
|
||||||
|
|
||||||
// Check credential status for a service (what's stored)
|
// Check credential status for a service (what's stored)
|
||||||
router.get('/:serviceId/credentials', asyncHandler(async (req, res) => {
|
router.get('/services/:serviceId/credentials', asyncHandler(async (req, res) => {
|
||||||
const { serviceId } = req.params;
|
const { serviceId } = req.params;
|
||||||
|
|
||||||
// Validate serviceId to prevent path traversal in credential keys
|
// Validate serviceId to prevent path traversal in credential keys
|
||||||
|
|||||||
Reference in New Issue
Block a user