diff --git a/src/display/fetch_stream.js b/src/display/fetch_stream.js index 6bdb6505e..12cd4008b 100644 --- a/src/display/fetch_stream.js +++ b/src/display/fetch_stream.js @@ -94,7 +94,7 @@ class PDFFetchStreamReader { let url = this._stream.source.url; fetch(url, createFetchOptions(this._headers, this._withCredentials)). then((response) => { - if (!validateResponseStatus(response.status, this._stream.isHttp)) { + if (!validateResponseStatus(response.status)) { throw createResponseStatusError(response.status, url); } this._reader = response.body.getReader(); @@ -188,7 +188,7 @@ class PDFFetchStreamRangeReader { let url = this._stream.source.url; fetch(url, createFetchOptions(this._headers, this._withCredentials)). then((response) => { - if (!validateResponseStatus(response.status, this._stream.isHttp)) { + if (!validateResponseStatus(response.status)) { throw createResponseStatusError(response.status, url); } this._readCapability.resolve(); diff --git a/src/display/network_utils.js b/src/display/network_utils.js index 94e6b2fc9..2aad2f64b 100644 --- a/src/display/network_utils.js +++ b/src/display/network_utils.js @@ -61,10 +61,7 @@ function createResponseStatusError(status, url) { ') while retrieving PDF "' + url + '".', status); } -function validateResponseStatus(status, isHttp) { - if (!isHttp) { - return status === 0; - } +function validateResponseStatus(status) { return status === 200 || status === 206; }