swagger-client 3.27.5 → 3.27.7
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/es/execute/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _matchAllInstanceProperty from "@babel/runtime-corejs3/core-js/instance/match-all";
|
|
1
2
|
import cookie from 'cookie';
|
|
2
3
|
import { isPlainObject } from 'is-plain-object';
|
|
3
4
|
import { escapeRegExp } from 'ramda-adjunct';
|
|
@@ -316,7 +317,7 @@ function oas3BaseUrl({
|
|
|
316
317
|
}
|
|
317
318
|
if (selectedServerUrl.includes('{')) {
|
|
318
319
|
// do variable substitution
|
|
319
|
-
const varNames =
|
|
320
|
+
const varNames = extractServerVariableNames(selectedServerUrl);
|
|
320
321
|
varNames.forEach(variable => {
|
|
321
322
|
if (selectedServerObj.variables && selectedServerObj.variables[variable]) {
|
|
322
323
|
// variable is defined in server
|
|
@@ -346,16 +347,9 @@ function buildOas3UrlWithContext(ourUrl = '', contextUrl = '') {
|
|
|
346
347
|
}
|
|
347
348
|
return res[res.length - 1] === '/' ? res.slice(0, -1) : res;
|
|
348
349
|
}
|
|
349
|
-
function
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
let text;
|
|
353
|
-
|
|
354
|
-
// eslint-disable-next-line no-cond-assign
|
|
355
|
-
while (text = re.exec(str)) {
|
|
356
|
-
results.push(text[1]);
|
|
357
|
-
}
|
|
358
|
-
return results;
|
|
350
|
+
function extractServerVariableNames(serverURL) {
|
|
351
|
+
const match = _matchAllInstanceProperty(serverURL).call(serverURL, /\{([^{}]+)}|([^{}]+)/g);
|
|
352
|
+
return Array.from(match, ([, variable]) => variable).filter(Boolean);
|
|
359
353
|
}
|
|
360
354
|
|
|
361
355
|
// Compose the baseUrl ( scheme + host + basePath )
|
package/lib/execute/index.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.baseUrl = baseUrl;
|
|
|
7
7
|
exports.buildRequest = buildRequest;
|
|
8
8
|
exports.execute = execute;
|
|
9
9
|
exports.self = void 0;
|
|
10
|
+
var _matchAll = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/match-all"));
|
|
10
11
|
var _cookie = _interopRequireDefault(require("cookie"));
|
|
11
12
|
var _isPlainObject = require("is-plain-object");
|
|
12
13
|
var _ramdaAdjunct = require("ramda-adjunct");
|
|
@@ -325,7 +326,7 @@ function oas3BaseUrl({
|
|
|
325
326
|
}
|
|
326
327
|
if (selectedServerUrl.includes('{')) {
|
|
327
328
|
// do variable substitution
|
|
328
|
-
const varNames =
|
|
329
|
+
const varNames = extractServerVariableNames(selectedServerUrl);
|
|
329
330
|
varNames.forEach(variable => {
|
|
330
331
|
if (selectedServerObj.variables && selectedServerObj.variables[variable]) {
|
|
331
332
|
// variable is defined in server
|
|
@@ -355,16 +356,9 @@ function buildOas3UrlWithContext(ourUrl = '', contextUrl = '') {
|
|
|
355
356
|
}
|
|
356
357
|
return res[res.length - 1] === '/' ? res.slice(0, -1) : res;
|
|
357
358
|
}
|
|
358
|
-
function
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
let text;
|
|
362
|
-
|
|
363
|
-
// eslint-disable-next-line no-cond-assign
|
|
364
|
-
while (text = re.exec(str)) {
|
|
365
|
-
results.push(text[1]);
|
|
366
|
-
}
|
|
367
|
-
return results;
|
|
359
|
+
function extractServerVariableNames(serverURL) {
|
|
360
|
+
const match = (0, _matchAll.default)(serverURL).call(serverURL, /\{([^{}]+)}|([^{}]+)/g);
|
|
361
|
+
return Array.from(match, ([, variable]) => variable).filter(Boolean);
|
|
368
362
|
}
|
|
369
363
|
|
|
370
364
|
// Compose the baseUrl ( scheme + host + basePath )
|