mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-24 17:03:47 +01:00
fix: openapi collection import to not add protocol by default (#3011)
* Update package.json * Update package.json * Update package.json * Update package.json * revert jest command * fix: openapi importwith server url * fix: updates
This commit is contained in:
parent
b102898709
commit
8a233fb489
@ -31,9 +31,8 @@ const readFile = (files) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ensureUrl = (url) => {
|
const ensureUrl = (url) => {
|
||||||
let protUrl = url.startsWith('http') ? url : `http://${url}`;
|
// emoving multiple slashes after the protocol if it exists, or after the beginning of the string otherwise
|
||||||
// replace any double or triple slashes
|
return url.replace(/(^\w+:|^)\/{2,}/, '$1/');
|
||||||
return protUrl.replace(/([^:]\/)\/+/g, '$1');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildEmptyJsonBody = (bodySchema) => {
|
const buildEmptyJsonBody = (bodySchema) => {
|
||||||
@ -67,7 +66,7 @@ const transformOpenapiRequestItem = (request) => {
|
|||||||
name: operationName,
|
name: operationName,
|
||||||
type: 'http-request',
|
type: 'http-request',
|
||||||
request: {
|
request: {
|
||||||
url: ensureUrl(request.global.server + '/' + path),
|
url: ensureUrl(request.global.server + path),
|
||||||
method: request.method.toUpperCase(),
|
method: request.method.toUpperCase(),
|
||||||
auth: {
|
auth: {
|
||||||
mode: 'none',
|
mode: 'none',
|
||||||
@ -306,7 +305,7 @@ const getDefaultUrl = (serverObject) => {
|
|||||||
url = url.replace(`{${variableName}}`, sub);
|
url = url.replace(`{${variableName}}`, sub);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return url;
|
return url.endsWith('/') ? url : `${url}/`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSecurity = (apiSpec) => {
|
const getSecurity = (apiSpec) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user