@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.
- package/dist/index.js +10 -3
- 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
|
|
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)
|
|
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
|
}
|