http-request-manager 18.13.14 → 18.13.15

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.
@@ -1057,13 +1057,31 @@ class QueryParamsTrackerService {
1057
1057
  }
1058
1058
  }
1059
1059
  normalizePath(pathSegments) {
1060
- return pathSegments
1060
+ const normalizedSegments = pathSegments
1061
+ .map((segment) => this.extractPathFromSegment(segment))
1062
+ .flatMap((segment) => segment.split('/'))
1061
1063
  .map((segment) => String(segment).trim())
1062
- .filter((segment) => segment.length > 0)
1063
- .join('/')
1064
- .replace(/([^:]\/+)\/+/g, '$1')
1065
- .replace(/^\//, '')
1066
- .replace(/\/$/, '');
1064
+ .filter((segment) => segment.length > 0);
1065
+ // Treat leading "rest" as transport/base-path noise for stable cache keys.
1066
+ if (normalizedSegments[0]?.toLowerCase() === 'rest') {
1067
+ normalizedSegments.shift();
1068
+ }
1069
+ return normalizedSegments.join('/');
1070
+ }
1071
+ extractPathFromSegment(segment) {
1072
+ const raw = String(segment).trim();
1073
+ if (!raw) {
1074
+ return '';
1075
+ }
1076
+ try {
1077
+ if (/^https?:\/\//i.test(raw)) {
1078
+ return new URL(raw).pathname;
1079
+ }
1080
+ }
1081
+ catch {
1082
+ return raw;
1083
+ }
1084
+ return raw;
1067
1085
  }
1068
1086
  normalizeParamKey(key) {
1069
1087
  return String(key).trim().toLowerCase();