v1.13.4: Standardize all route responses to use response helpers
Convert ~160 raw res.json()/res.status().json() calls across 32+ files to use centralized helpers from src/utils/responses.js (ok, errorResponse, successMessage, notFound, validationError, forbidden, unauthorized, conflict). No behavior changes — response shapes are identical. Future schema changes (e.g., requestId envelope) only need to update one module. Fix error vs errorResponse signature mismatch in routes/health.js CA cert endpoint where error(res, message, statusCode) was being called with errorResponse(res, statusCode, message, extras) argument order. Files changed: middleware.js, csrf-protection.js, error-handler.js, license-manager.js, src/app.js, and 27 route files. Test suite: 755 pass / 4 pre-existing failures (services credential tests).
This commit is contained in:
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.13.4] - 2026-06-12
|
||||
|
||||
### Changed
|
||||
- Standardized all route handler responses to use helpers from `src/utils/responses.js`
|
||||
(`ok`, `errorResponse`, `successMessage`, `notFound`, `validationError`, `forbidden`,
|
||||
`unauthorized`, `conflict`). ~160 raw `res.json()` calls converted across 32+ files.
|
||||
No behavior changes — response shapes are identical. This ensures future schema
|
||||
changes (e.g., adding a `requestId` envelope) only need to update one module.
|
||||
- Fixed `error` vs `errorResponse` signature mismatch in `routes/health.js` CA cert
|
||||
endpoint. The `error` helper takes `(res, message, statusCode)` while `errorResponse`
|
||||
takes `(res, statusCode, message, extras)` — the wrong alias was being used for
|
||||
calls that needed the 4-argument form.
|
||||
- Updated `middleware.js`, `csrf-protection.js`, `error-handler.js`, and
|
||||
`license-manager.js` to use response helpers for rejection/error responses
|
||||
instead of inline `res.status().json()`.
|
||||
|
||||
### Note
|
||||
- 4 pre-existing test failures in `services.routes.test.js` (credential storage)
|
||||
remain from before this release. They are unrelated to the standardization pass.
|
||||
|
||||
## [1.5.0] - 2026-05-17
|
||||
|
||||
### Changed (BREAKING)
|
||||
|
||||
Reference in New Issue
Block a user