DC-010: Convert remaining bare res.json({success,...}) envelopes to response helper
CI / Test & Lint (push) Has been cancelled
CI / Security audit (push) Has been cancelled

Routes covered in this batch:
- routes/events.js (1 call: GET /status)
- routes/workflows.js (6 calls: GET/POST/PUT/DELETE /workflows, POST /test, POST /:id/toggle)
- routes/openclaw.js (4 calls: GET /:hostname, DELETE /:hostname, POST /connect, GET /status)
- routes/dns.js (1 call: POST /credentials per-server results envelope)

Wire format unchanged — each handler now produces the same {success, ...} shape via success(). Net result: every {success, ...} envelope in routes/ now flows through the response helper, leaving only the intentional raw-array calls (services.js) and error-path envelopes for separate cleanup.
This commit is contained in:
Hermes
2026-06-25 15:44:18 -07:00
parent c509f6ff10
commit 2f50998105
5 changed files with 31 additions and 29 deletions
+3 -2
View File
@@ -8,9 +8,10 @@ const express = require('express');
* @param {Object} deps.healthChecker - Health checker
* @param {Object} deps.updateManager - Update manager
* @param {Function} deps.logError - Error logging function
* @param {Function} deps.ok - Success response helper
* @returns {express.Router}
*/
module.exports = function({ resourceMonitor, healthChecker, updateManager, logError }) {
module.exports = function({ resourceMonitor, healthChecker, updateManager, logError, ok }) {
const router = express.Router();
const clients = new Set();
@@ -104,7 +105,7 @@ module.exports = function({ resourceMonitor, healthChecker, updateManager, logEr
// Client count (useful for debugging)
router.get('/clients', (req, res) => {
res.json({ success: true, count: clients.size });
ok(res, { count: clients.size });
});
return router;