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

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

Merged
merged 2 commits into from Oct 31, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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);
});

});