@taybart/corvid 0.1.7 → 0.1.8

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 (2) hide show
  1. package/dist/index.js +10 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -493,10 +493,13 @@ class request {
493
493
  const body = override.body || this.opts.body;
494
494
  let url = this.opts.url;
495
495
  if (path) url = `${this.opts.url}${path}`;
496
- let reqParams;
497
- if (override.params || this.opts.params) reqParams = new network_params(override.params || this.opts.params);
496
+ let reqParams = this.opts.params;
497
+ if (override.params) reqParams = new network_params(override.params);
498
498
  if (passedParams) reqParams = reqParams ? new network_params(reqParams).set(passedParams) : new network_params(passedParams);
499
- if (reqParams) url = `${url}?${reqParams.toString()}`;
499
+ if (reqParams) {
500
+ this.log.debug(`params: ${reqParams.toString()}`);
501
+ url = `${url}?${reqParams.toString()}`;
502
+ }
500
503
  this.log.debug(`${this.opts.method} ${url}`);
501
504
  const res = await fetch(url, {
502
505
  method: this.opts.method,
@@ -526,6 +529,10 @@ class request {
526
529
  if (!this.opts.method) this.opts.method = 'GET';
527
530
  if (!this.opts.headers) this.opts.headers = {};
528
531
  if (!this.opts.credentials) this.opts.credentials = 'omit';
532
+ if (!this.opts.params && 'object' == typeof opts.params) {
533
+ this.log.debug("converting object params to class");
534
+ this.opts.params = new network_params(opts.params);
535
+ }
529
536
  this.log.debug(`with options: ${JSON.stringify(this.opts)}`);
530
537
  }
531
538
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taybart/corvid",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "exports": {