bajo-extra 1.1.7 → 1.1.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bajo-extra",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "Extra package for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/plugin/factory.js CHANGED
@@ -2,7 +2,7 @@ import bcrypt from 'bcrypt'
2
2
  import crypto from 'crypto'
3
3
  import { createGzip, createGunzip } from 'zlib'
4
4
  import path from 'path'
5
- import { fetch } from 'undici'
5
+ import { fetch, Agent } from 'undici'
6
6
  import { Readable } from 'stream'
7
7
  import numbro from 'numbro'
8
8
  import { ShortCrypt } from 'short-crypt'
@@ -118,7 +118,10 @@ async function factory (pkgName) {
118
118
  this.config = {
119
119
  secret: 'hxKY8Eh63Op9js6ovU25qmq2DmCE9dIB',
120
120
  fetch: {
121
- agent: {}
121
+ agent: {
122
+ autoSelectFamilyAttemptTimeout: 1000,
123
+ autoSelectFamily: true
124
+ }
122
125
  }
123
126
  }
124
127
  }
@@ -266,12 +269,15 @@ async function factory (pkgName) {
266
269
  delete opts.auth
267
270
  }
268
271
  const query = merge({}, opts.query, opts.params ?? {})
272
+ for (const q in query) {
273
+ if (!isSet(query[q])) delete query[q]
274
+ }
269
275
  if (!isEmpty(query)) opts.query = query
270
276
  delete opts.params
271
277
  if (!has(extra, 'cacheBuster')) extra.cacheBuster = true
272
278
  if (extra.cacheBuster) opts.query[extra.cacheBusterKey ?? '_'] = Date.now()
273
279
  if (this.config.fetch.agent || extra.agent) {
274
- // opts.dispatcher = new Agent(extra.agent ?? this.config.fetch.agent)
280
+ opts.dispatcher = new Agent(extra.agent ?? this.config.fetch.agent)
275
281
  }
276
282
  if (opts.body && extra.formData) {
277
283
  const formData = new FormData()