@igniter-js/caller 0.1.56 → 0.1.57
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 +15 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -412,11 +412,22 @@ var IgniterCallerUrlUtils = class {
|
|
|
412
412
|
if (baseURL && !/^https?:\/\//i.test(url)) {
|
|
413
413
|
fullUrl = baseURL + url;
|
|
414
414
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
415
|
+
const queryParams = {};
|
|
416
|
+
if (query) {
|
|
417
|
+
Object.entries(query).forEach(([key, value]) => {
|
|
418
|
+
const placeholder = `:${key}`;
|
|
419
|
+
if (fullUrl.includes(placeholder)) {
|
|
420
|
+
fullUrl = fullUrl.split(placeholder).join(encodeURIComponent(String(value)));
|
|
421
|
+
} else {
|
|
422
|
+
queryParams[key] = value;
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
if (Object.keys(queryParams).length > 0) {
|
|
427
|
+
const queryString = new URLSearchParams(
|
|
428
|
+
Object.entries(queryParams).map(([key, value]) => [key, String(value)])
|
|
418
429
|
).toString();
|
|
419
|
-
fullUrl += (fullUrl.includes("?") ? "&" : "?") +
|
|
430
|
+
fullUrl += (fullUrl.includes("?") ? "&" : "?") + queryString;
|
|
420
431
|
}
|
|
421
432
|
return fullUrl;
|
|
422
433
|
}
|