diff --git a/streaming-client-api.js b/streaming-client-api.js index c5b7cefa..866e5ed2 100644 --- a/streaming-client-api.js +++ b/streaming-client-api.js @@ -391,7 +391,12 @@ const maxDelaySec = 4; async function fetchWithRetries(url, options, retries = 1) { try { - return await fetch(url, options); + const res = await fetch(url, options); + if(res.status >= 200 && res.status <= 299) { + return res; + } else { + throw new Error(`Response status ${res.status}`); + } } catch (err) { if (retries <= maxRetryCount) { const delay = Math.min(Math.pow(2, retries) / 4 + Math.random(), maxDelaySec) * 1000;