Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevented uncaught exception if body is null (fixes MS Edge getReader bug) #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/response.js
Expand Up @@ -74,6 +74,11 @@ var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, f
} catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this
}
// fallback for when writableStream or pipeTo aren't available
if (!response.body) {
global.clearTimeout(fetchTimer)
self.push(null)
return
}
var reader = response.body.getReader()
function read () {
reader.read().then(function (result) {
Expand Down