From f56b0c66d3dd2ef185436de1f2fd40f66bfea8f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20W=C3=A4rting?= Date: Sun, 31 Oct 2021 16:40:17 +0100 Subject: [PATCH] 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 --- package.json | 2 +- src/request.js | 2 +- test/test.js | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4178c1a32..ec0510513 100644 --- a/package.json +++ b/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", diff --git a/src/request.js b/src/request.js index 59850fd95..739ba9071 100644 --- a/src/request.js +++ b/src/request.js @@ -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; diff --git a/test/test.js b/test/test.js index 9568489e3..6427ae21e 100644 --- a/test/test.js +++ b/test/test.js @@ -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); + }); + }); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy