echoapi-converter 0.0.71 → 0.0.72
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/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4920,11 +4920,19 @@ const completionPostmanTarget = (targetItem) => {
|
|
|
4920
4920
|
};
|
|
4921
4921
|
const getHostWithPortFromUrl = (urlString) => {
|
|
4922
4922
|
try {
|
|
4923
|
+
if (urlString.length <= 0) {
|
|
4924
|
+
return {};
|
|
4925
|
+
}
|
|
4923
4926
|
const url = new URL(urlString);
|
|
4924
|
-
return
|
|
4927
|
+
return {
|
|
4928
|
+
host: url.host.split('.'),
|
|
4929
|
+
protocol: lodash.replace(url.protocol, new RegExp(':', 'g'), ''),
|
|
4930
|
+
}; // 返回包含端口号的host部分(如果有的话)
|
|
4925
4931
|
}
|
|
4926
4932
|
catch (error) {
|
|
4927
|
-
return
|
|
4933
|
+
return {
|
|
4934
|
+
host: [urlString],
|
|
4935
|
+
};
|
|
4928
4936
|
}
|
|
4929
4937
|
};
|
|
4930
4938
|
const urlHost = getHostWithPortFromUrl((targetItem === null || targetItem === void 0 ? void 0 : targetItem.url) || '');
|
|
@@ -4933,8 +4941,11 @@ const completionPostmanTarget = (targetItem) => {
|
|
|
4933
4941
|
query: getPostmanQuery((_b = (_a = targetItem === null || targetItem === void 0 ? void 0 : targetItem.request) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.parameter),
|
|
4934
4942
|
variable: getPostmanVariable((_d = (_c = targetItem === null || targetItem === void 0 ? void 0 : targetItem.request) === null || _c === void 0 ? void 0 : _c.restful) === null || _d === void 0 ? void 0 : _d.parameter)
|
|
4935
4943
|
};
|
|
4936
|
-
if (urlHost) {
|
|
4937
|
-
urlObj.
|
|
4944
|
+
if (urlHost === null || urlHost === void 0 ? void 0 : urlHost.protocol) {
|
|
4945
|
+
urlObj.protocol = urlHost === null || urlHost === void 0 ? void 0 : urlHost.protocol;
|
|
4946
|
+
}
|
|
4947
|
+
if (lodash.isArray(urlHost.host)) {
|
|
4948
|
+
urlObj.host = urlHost.host;
|
|
4938
4949
|
}
|
|
4939
4950
|
return urlObj;
|
|
4940
4951
|
};
|