fix(helcim): tolerate empty response body on DELETE (204)
helcimFetch called response.json() unconditionally, which threw "Unexpected end of JSON input" on Helcim's 204 No Content responses (e.g. DELETE /subscriptions/:id). The error was silently swallowed by the best-effort cancel path in cancel-subscription, masking cases where the Helcim-side cancel actually succeeded.
This commit is contained in:
parent
549a849bc0
commit
8ceaebb268
1 changed files with 7 additions and 1 deletions
|
|
@ -63,7 +63,13 @@ export async function helcimFetch(path, { method = 'GET', body, idempotencyKey,
|
|||
})
|
||||
}
|
||||
|
||||
return await response.json()
|
||||
const text = await response.text()
|
||||
if (!text.trim()) return null
|
||||
try {
|
||||
return JSON.parse(text)
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Customers ----
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue