@whatwg-node/node-fetch 0.7.5 → 0.7.6-alpha-20241227034944-ae3ab11b792acef83302670c6b44a630daf4f2f1

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/cjs/URL.js CHANGED
@@ -23,6 +23,11 @@ class PonyfillURL extends fast_url_parser_1.default {
23
23
  IPV6_REGEX.test(this.hostname)) {
24
24
  this.hostname = `[${this.hostname}]`;
25
25
  }
26
+ if (url.includes(`${this.hostname}:`) && !this.port && this.pathname.startsWith('/:')) {
27
+ this.port = this.pathname.slice(2);
28
+ this.pathname = '/';
29
+ this.host = `${this.hostname}:${this.port}`;
30
+ }
26
31
  if (base) {
27
32
  const baseParsed = typeof base === 'string' ? new PonyfillURL(base) : base;
28
33
  this.protocol ||= baseParsed.protocol;
@@ -32,7 +37,7 @@ class PonyfillURL extends fast_url_parser_1.default {
32
37
  }
33
38
  }
34
39
  get origin() {
35
- return `${this.protocol}//${this.host}${this.port ? `:${this.port}` : ''}`;
40
+ return `${this.protocol}//${this.hostname}${this.port ? `:${this.port}` : ''}`;
36
41
  }
37
42
  _searchParams;
38
43
  get searchParams() {
package/esm/URL.js CHANGED
@@ -19,6 +19,11 @@ export class PonyfillURL extends FastUrl {
19
19
  IPV6_REGEX.test(this.hostname)) {
20
20
  this.hostname = `[${this.hostname}]`;
21
21
  }
22
+ if (url.includes(`${this.hostname}:`) && !this.port && this.pathname.startsWith('/:')) {
23
+ this.port = this.pathname.slice(2);
24
+ this.pathname = '/';
25
+ this.host = `${this.hostname}:${this.port}`;
26
+ }
22
27
  if (base) {
23
28
  const baseParsed = typeof base === 'string' ? new PonyfillURL(base) : base;
24
29
  this.protocol ||= baseParsed.protocol;
@@ -28,7 +33,7 @@ export class PonyfillURL extends FastUrl {
28
33
  }
29
34
  }
30
35
  get origin() {
31
- return `${this.protocol}//${this.host}${this.port ? `:${this.port}` : ''}`;
36
+ return `${this.protocol}//${this.hostname}${this.port ? `:${this.port}` : ''}`;
32
37
  }
33
38
  _searchParams;
34
39
  get searchParams() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.7.5",
3
+ "version": "0.7.6-alpha-20241227034944-ae3ab11b792acef83302670c6b44a630daf4f2f1",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {