diff --git a/src/sonarr.js b/src/sonarr.js index 1d29cd3..d0c7d18 100644 --- a/src/sonarr.js +++ b/src/sonarr.js @@ -22,7 +22,9 @@ async function sonarrReq(method, path, body) { throw new Error('Sonarr ' + method + ' ' + path + ' -> HTTP ' + res.status + ': ' + text.slice(0, 200)); } if (res.status === 204) return null; - return res.json(); + const text = await res.text(); + if (!text) return null; + return JSON.parse(text); } const QUEUE_SKIP_STATUSES = new Set(['downloading', 'queued', 'delay', 'completed']);