Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ http.Agent = function () {};
http.Agent.defaultMaxSockets = 4;

var xhrHttp = (function () {
if (typeof window === 'undefined') {
if (typeof self !== 'undefined' && self.XMLHttpRequest) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this:

if (typeof XMLHttpRequest !== 'undefined') {
    return XMLHttpRequest;
}

And then remove the second check for window.XMLHttpRequest below.

return self.XMLHttpRequest;
}
else if (typeof window === 'undefined') {
throw new Error('no window object present');
}
else if (window.XMLHttpRequest) {
Expand Down