Standardize response shapes and fix dead fetchT timeout keys
Three small cleanups for v1.14.0:
1. /caddy/cas now uses standard success envelope
Was: { status: 'success', data: { cas: caList } }
Now: { success: true, cas: caList }
Updated frontend service-infrastructure.js to match.
2. /api/health/ca now uses standard envelope + meaningful HTTP codes
Was: { status, message, daysUntilExpiration } with 200 on every error
Now: { success, caStatus, message|error, daysUntilExpiration }
with 200 / 404 / 500 as appropriate
caStatus field preserves the original 'healthy'/'warning'/'critical'/'error'
semantic so any future consumer of the CA-health state still has it.
Tests updated to match.
3. Dead timeout: keys in fetchT opts are now a warning, not a silent strip
src/utils/http.js:41 used to do without telling
anyone. Callers that wrote fetchT(url, { timeout: 5000 }) got the default
5s timeout with no indication that their explicit value was ignored.
Now it logs a warning naming the call site, then strips the key.
Fixed 4 call sites that had stale timeout: keys:
- src/context/caddy.js
- src/context/dns.js
- src/context/provider-dns.js
- routes/dns.js (2 places)
This commit is contained in:
@@ -14,15 +14,15 @@
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.status === 'success') {
|
||||
if (result.success) {
|
||||
const select = document.getElementById('existing-ca-select');
|
||||
select.innerHTML = '';
|
||||
|
||||
if (result.data.cas.length === 0) {
|
||||
if (result.cas.length === 0) {
|
||||
select.innerHTML = '<option value="">No CAs found in Caddyfile</option>';
|
||||
} else {
|
||||
select.innerHTML = '<option value="">Select existing CA...</option>';
|
||||
result.data.cas.forEach(ca => {
|
||||
result.cas.forEach(ca => {
|
||||
const option = document.createElement('option');
|
||||
if (typeof ca === 'object') {
|
||||
option.value = ca.id;
|
||||
|
||||
Reference in New Issue
Block a user