Content-Length: 317912 | pFad | https://github.com/node-fetch/node-fetch/commit/f56b0c66d3dd2ef185436de1f2fd40f66bfea8f4

31 fix(URL): prefer built in URL version when available and fallback to … · node-fetch/node-fetch@f56b0c6 · GitHub
Skip to content

Commit f56b0c6

Browse files
authored
fix(URL): prefer built in URL version when available and fallback to whatwg (#1352)
* fix(URL): prefer built in URL version when available and fallback to whatwg * bump minor
1 parent b5417ae commit f56b0c6

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-fetch",
3-
"version": "2.6.5",
3+
"version": "2.6.6",
44
"description": "A light-weight module that brings window.fetch to node.js",
55
"main": "lib/index.js",
66
"browser": "./browser.js",

src/request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Headers, { exportNodeCompatibleHeaders } from './headers.js';
1414
import Body, { clone, extractContentType, getTotalBytes } from './body';
1515

1616
const INTERNALS = Symbol('Request internals');
17-
const URL = whatwgUrl.URL;
17+
const URL = Url.URL || whatwgUrl.URL;
1818

1919
// fix an issue where "format", "parse" aren't a named export for node <10
2020
const parse_url = Url.parse;

test/test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,4 +2875,11 @@ describe('issue #1290', function() {
28752875
});
28762876
});
28772877
});
2878+
2879+
// #1342
2880+
it('should not throw with a valid URL', () => {
2881+
const url = 'https://r2---sn-n4v7sney.example.com';
2882+
new Request(url);
2883+
});
2884+
28782885
});

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/node-fetch/node-fetch/commit/f56b0c66d3dd2ef185436de1f2fd40f66bfea8f4

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy