@whatwg-node/node-fetch 0.0.6-alpha-20230207093213-131f46f → 0.0.6-alpha-20230207114030-349e836

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.
Files changed (3) hide show
  1. package/index.js +9 -9
  2. package/index.mjs +9 -9
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -729,11 +729,12 @@ class PonyfillHeaders {
729
729
  });
730
730
  }
731
731
  else {
732
- for (const key in headersInit) {
733
- const value = headersInit[key];
734
- if (value != null) {
735
- const normalizedValue = Array.isArray(value) ? value.join(', ') : value;
736
- this.map.set(key, normalizedValue);
732
+ for (const initKey in headersInit) {
733
+ const initValue = headersInit[initKey];
734
+ if (initValue != null) {
735
+ const normalizedValue = Array.isArray(initValue) ? initValue.join(', ') : initValue;
736
+ const normalizedKey = initKey.toLowerCase();
737
+ this.map.set(normalizedKey, normalizedValue);
737
738
  }
738
739
  }
739
740
  }
@@ -741,10 +742,9 @@ class PonyfillHeaders {
741
742
  }
742
743
  append(name, value) {
743
744
  const key = name.toLowerCase();
744
- if (this.map.has(key)) {
745
- value = this.map.get(key) + ', ' + value;
746
- }
747
- this.map.set(key, value);
745
+ const existingValue = this.map.get(key);
746
+ const finalValue = existingValue ? `${existingValue}, ${value}` : value;
747
+ this.map.set(key, finalValue);
748
748
  }
749
749
  get(name) {
750
750
  const key = name.toLowerCase();
package/index.mjs CHANGED
@@ -723,11 +723,12 @@ class PonyfillHeaders {
723
723
  });
724
724
  }
725
725
  else {
726
- for (const key in headersInit) {
727
- const value = headersInit[key];
728
- if (value != null) {
729
- const normalizedValue = Array.isArray(value) ? value.join(', ') : value;
730
- this.map.set(key, normalizedValue);
726
+ for (const initKey in headersInit) {
727
+ const initValue = headersInit[initKey];
728
+ if (initValue != null) {
729
+ const normalizedValue = Array.isArray(initValue) ? initValue.join(', ') : initValue;
730
+ const normalizedKey = initKey.toLowerCase();
731
+ this.map.set(normalizedKey, normalizedValue);
731
732
  }
732
733
  }
733
734
  }
@@ -735,10 +736,9 @@ class PonyfillHeaders {
735
736
  }
736
737
  append(name, value) {
737
738
  const key = name.toLowerCase();
738
- if (this.map.has(key)) {
739
- value = this.map.get(key) + ', ' + value;
740
- }
741
- this.map.set(key, value);
739
+ const existingValue = this.map.get(key);
740
+ const finalValue = existingValue ? `${existingValue}, ${value}` : value;
741
+ this.map.set(key, finalValue);
742
742
  }
743
743
  get(name) {
744
744
  const key = name.toLowerCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.0.6-alpha-20230207093213-131f46f",
3
+ "version": "0.0.6-alpha-20230207114030-349e836",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {