urllib 3.22.0 → 3.22.1

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.
@@ -67,7 +67,7 @@ class BlobFromStream {
67
67
  return 'Blob';
68
68
  }
69
69
  }
70
- exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.22.0');
70
+ exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.22.1');
71
71
  function getFileName(stream) {
72
72
  const filePath = stream.path;
73
73
  if (filePath) {
@@ -113,6 +113,9 @@ class HttpClient extends node_events_1.EventEmitter {
113
113
  // origin => Pool Instance
114
114
  const clients = agent[symbols_js_1.default.kClients];
115
115
  const poolStatsMap = {};
116
+ if (!clients) {
117
+ return poolStatsMap;
118
+ }
116
119
  for (const [key, ref] of clients) {
117
120
  const pool = ref.deref();
118
121
  const stats = pool?.stats;
@@ -61,7 +61,7 @@ class BlobFromStream {
61
61
  return 'Blob';
62
62
  }
63
63
  }
64
- export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.22.0');
64
+ export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.22.1');
65
65
  function getFileName(stream) {
66
66
  const filePath = stream.path;
67
67
  if (filePath) {
@@ -107,6 +107,9 @@ export class HttpClient extends EventEmitter {
107
107
  // origin => Pool Instance
108
108
  const clients = agent[undiciSymbols.kClients];
109
109
  const poolStatsMap = {};
110
+ if (!clients) {
111
+ return poolStatsMap;
112
+ }
110
113
  for (const [key, ref] of clients) {
111
114
  const pool = ref.deref();
112
115
  const stats = pool?.stats;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "urllib",
3
- "version": "3.22.0",
3
+ "version": "3.22.1",
4
4
  "publishConfig": {
5
5
  "tag": "latest"
6
6
  },
package/src/HttpClient.ts CHANGED
@@ -206,8 +206,11 @@ export class HttpClient extends EventEmitter {
206
206
  getDispatcherPoolStats() {
207
207
  const agent = this.getDispatcher();
208
208
  // origin => Pool Instance
209
- const clients: Map<string, WeakRef<Pool>> = agent[undiciSymbols.kClients];
209
+ const clients: Map<string, WeakRef<Pool>> | undefined = agent[undiciSymbols.kClients];
210
210
  const poolStatsMap: Record<string, PoolStat> = {};
211
+ if (!clients) {
212
+ return poolStatsMap;
213
+ }
211
214
  for (const [ key, ref ] of clients) {
212
215
  const pool = ref.deref();
213
216
  const stats = pool?.stats;