@whatwg-node/node-fetch 0.7.4-alpha-20241125130302-670fd9851060fb8e736194f703f4026f9566bf40 → 0.7.4-alpha-20241125131513-7ac7e92d53ef0d5a6ddab6fcb0b311d88708df6d

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/Request.js CHANGED
@@ -107,7 +107,7 @@ class PonyfillRequest extends Body_js_1.PonyfillBody {
107
107
  get parsedUrl() {
108
108
  if (this._parsedUrl == null) {
109
109
  if (this._url != null) {
110
- this._parsedUrl = new URL_js_1.PonyfillURL(this._url);
110
+ this._parsedUrl = new URL_js_1.PonyfillURL(this._url, 'http://localhost');
111
111
  }
112
112
  else {
113
113
  throw new TypeError('Invalid URL');
package/cjs/URL.js CHANGED
@@ -19,14 +19,14 @@ class PonyfillURL extends fast_url_parser_1.default {
19
19
  this.parse(url, false);
20
20
  if (base) {
21
21
  const baseParsed = typeof base === 'string' ? new PonyfillURL(base) : base;
22
- this.protocol = this.protocol || baseParsed.protocol;
23
- this.host = this.host || baseParsed.host;
24
- this.pathname = this.pathname || baseParsed.pathname;
25
- this.port = this.port || baseParsed.port;
22
+ this.protocol ||= baseParsed.protocol;
23
+ this.host ||= baseParsed.host;
24
+ this.pathname ||= baseParsed.pathname;
25
+ this.port ||= baseParsed.port;
26
26
  }
27
27
  }
28
28
  get origin() {
29
- return `${this.protocol}//${this.host}`;
29
+ return `${this.protocol}//${this.host}${this.port ? `:${this.port}` : ''}`;
30
30
  }
31
31
  _searchParams;
32
32
  get searchParams() {
@@ -35,6 +35,9 @@ function fetchNodeHttp(fetchRequest) {
35
35
  let nodeRequest;
36
36
  if (fetchRequest.parsedUrl) {
37
37
  nodeRequest = requestFn({
38
+ auth: fetchRequest.parsedUrl.username
39
+ ? `${fetchRequest.parsedUrl.username}:${fetchRequest.parsedUrl.password}`
40
+ : undefined,
38
41
  host: fetchRequest.parsedUrl.host,
39
42
  hostname: fetchRequest.parsedUrl.hostname,
40
43
  method: fetchRequest.method,
package/esm/Request.js CHANGED
@@ -104,7 +104,7 @@ export class PonyfillRequest extends PonyfillBody {
104
104
  get parsedUrl() {
105
105
  if (this._parsedUrl == null) {
106
106
  if (this._url != null) {
107
- this._parsedUrl = new PonyfillURL(this._url);
107
+ this._parsedUrl = new PonyfillURL(this._url, 'http://localhost');
108
108
  }
109
109
  else {
110
110
  throw new TypeError('Invalid URL');
package/esm/URL.js CHANGED
@@ -15,14 +15,14 @@ export class PonyfillURL extends FastUrl {
15
15
  this.parse(url, false);
16
16
  if (base) {
17
17
  const baseParsed = typeof base === 'string' ? new PonyfillURL(base) : base;
18
- this.protocol = this.protocol || baseParsed.protocol;
19
- this.host = this.host || baseParsed.host;
20
- this.pathname = this.pathname || baseParsed.pathname;
21
- this.port = this.port || baseParsed.port;
18
+ this.protocol ||= baseParsed.protocol;
19
+ this.host ||= baseParsed.host;
20
+ this.pathname ||= baseParsed.pathname;
21
+ this.port ||= baseParsed.port;
22
22
  }
23
23
  }
24
24
  get origin() {
25
- return `${this.protocol}//${this.host}`;
25
+ return `${this.protocol}//${this.host}${this.port ? `:${this.port}` : ''}`;
26
26
  }
27
27
  _searchParams;
28
28
  get searchParams() {
@@ -32,6 +32,9 @@ export function fetchNodeHttp(fetchRequest) {
32
32
  let nodeRequest;
33
33
  if (fetchRequest.parsedUrl) {
34
34
  nodeRequest = requestFn({
35
+ auth: fetchRequest.parsedUrl.username
36
+ ? `${fetchRequest.parsedUrl.username}:${fetchRequest.parsedUrl.password}`
37
+ : undefined,
35
38
  host: fetchRequest.parsedUrl.host,
36
39
  hostname: fetchRequest.parsedUrl.hostname,
37
40
  method: fetchRequest.method,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.7.4-alpha-20241125130302-670fd9851060fb8e736194f703f4026f9566bf40",
3
+ "version": "0.7.4-alpha-20241125131513-7ac7e92d53ef0d5a6ddab6fcb0b311d88708df6d",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {