follow-redirects 1.15.7 → 1.15.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -10
- package/nope.js +8 -9
- package/package.json +1 -1
package/index.js
CHANGED
@@ -7,17 +7,10 @@ var assert = require("assert");
|
|
7
7
|
var debug = require("./debug");
|
8
8
|
var nope = require("./nope");
|
9
9
|
|
10
|
-
// Disaster prevention
|
11
|
-
/* istanbul ignore next */
|
12
|
-
if (nope.isBrowser()) {
|
13
|
-
module.exports = nope;
|
14
|
-
return;
|
15
|
-
}
|
16
|
-
|
17
10
|
// Whether to use the native URL object or the legacy url module
|
18
11
|
var useNativeURL = false;
|
19
12
|
try {
|
20
|
-
assert(new URL());
|
13
|
+
assert(new URL(""));
|
21
14
|
}
|
22
15
|
catch (error) {
|
23
16
|
useNativeURL = error.code === "ERR_INVALID_URL";
|
@@ -492,7 +485,7 @@ RedirectableRequest.prototype._processResponse = function (response) {
|
|
492
485
|
};
|
493
486
|
|
494
487
|
// Wraps the key/value object of protocols with redirect functionality
|
495
|
-
function wrap(protocols) {
|
488
|
+
var wrap = nope.wrap || function wrap(protocols) {
|
496
489
|
// Default settings
|
497
490
|
var exports = {
|
498
491
|
maxRedirects: 21,
|
@@ -554,7 +547,7 @@ function wrap(protocols) {
|
|
554
547
|
});
|
555
548
|
});
|
556
549
|
return exports;
|
557
|
-
}
|
550
|
+
};
|
558
551
|
|
559
552
|
function noop() { /* empty */ }
|
560
553
|
|
package/nope.js
CHANGED
@@ -1,20 +1,19 @@
|
|
1
1
|
// follow-redirects absolutely must not be used in the browser.
|
2
|
-
// Neither should the `http` and `
|
2
|
+
// Neither should the `http` and `https` modules it replaces, yet here we are.
|
3
3
|
var http = require("http");
|
4
4
|
var https = require("https");
|
5
5
|
|
6
|
-
|
6
|
+
// eslint-disable-next-line no-undef
|
7
7
|
var browser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
8
8
|
|
9
9
|
module.exports = {
|
10
10
|
http: http,
|
11
11
|
https: https,
|
12
|
-
wrap: function () {
|
13
|
-
//
|
14
|
-
|
15
|
-
|
16
|
-
isBrowser() {
|
17
|
-
/* istanbul ignore next */ // eslint-disable-next-line
|
18
|
-
return browser && !!console.warn("Exclude follow-redirects from browser builds.");
|
12
|
+
wrap: browser && function (module) {
|
13
|
+
// eslint-disable-next-line
|
14
|
+
console.warn("Exclude follow-redirects from browser builds.");
|
15
|
+
return module;
|
19
16
|
},
|
20
17
|
};
|
18
|
+
|
19
|
+
/* istanbul ignore file */
|