Skip to content

Commit

Permalink
fix(URL): prefer built in URL version when available and fallback to …
Browse files Browse the repository at this point in the history
…whatwg (#1352)

* fix(URL): prefer built in URL version when available and fallback to whatwg

* bump minor
  • Loading branch information
jimmywarting committed Oct 31, 2021
1 parent b5417ae commit f56b0c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "node-fetch",
"version": "2.6.5",
"version": "2.6.6",
"description": "A light-weight module that brings window.fetch to node.js",
"main": "lib/index.js",
"browser": "./browser.js",
Expand Down
2 changes: 1 addition & 1 deletion src/request.js
Expand Up @@ -14,7 +14,7 @@ import Headers, { exportNodeCompatibleHeaders } from './headers.js';
import Body, { clone, extractContentType, getTotalBytes } from './body';

const INTERNALS = Symbol('Request internals');
const URL = whatwgUrl.URL;
const URL = Url.URL || whatwgUrl.URL;

// fix an issue where "format", "parse" aren't a named export for node <10
const parse_url = Url.parse;
Expand Down
7 changes: 7 additions & 0 deletions test/test.js
Expand Up @@ -2875,4 +2875,11 @@ describe('issue #1290', function() {
});
});
});

// #1342
it('should not throw with a valid URL', () => {
const url = 'https://r2---sn-n4v7sney.example.com';
new Request(url);
});

});

0 comments on commit f56b0c6

Please sign in to comment.