fix(web): handle empty-body 2xx responses; fix(store): sync DeleteDomainsNotInZones query with generated columns
req() in the frontend api client called res.json() on every non-204 2xx response, which throws SyntaxError on the empty body returned by POST .../customs (201) and similar endpoints. Read the response body once as text and parse it only when non-empty, so any bodyless 2xx resolves instead of rejecting. Added web/src/api/client.test.ts coverage that exercises the real req() against a stubbed fetch for both the 201 (addCustom) and 204 (removeCustom) empty-body cases. Also brought internal/store/queries/domains.sql's DeleteDomainsNotInZones query back in sync with the hand-maintained internal/store/db/domains.sql.go (RETURNING * -> explicit column list) since sqlc isn't installed in this environment and the two files are kept aligned by hand. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yr8frsaxBgab1Aa7yfPuU
This commit is contained in:
@@ -41,4 +41,4 @@ SELECT count(*) FROM domains WHERE last_check_status = 'drift';
|
||||
-- name: DeleteDomainsNotInZones :many
|
||||
DELETE FROM domains
|
||||
WHERE project_id = $1 AND provider_account_id = $2 AND zone_id <> ALL($3::text[])
|
||||
RETURNING *;
|
||||
RETURNING id, project_id, provider_account_id, zone_name, zone_id, template_id, created_at, last_check_status;
|
||||
|
||||
Reference in New Issue
Block a user