mirror of
https://github.com/Kong/insomnia.git
synced 2026-10-25 16:19:20 -04:00
Strip trailing slash on openapi import base_url env
This commit is contained in:
1 parent
7b3ae5bfd8
commit
9b39fbf36f
2 files changed
+6
-2
No files matched your search
@@ -19,7 +19,7 @@
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "http://petstore.swagger.io/v2"
|
||||
"url": "http://petstore.swagger.io/v2/"
|
||||
}
|
||||
],
|
||||
"tags": [],
|
||||
|
||||
@@ -67,6 +67,10 @@ module.exports.convert = async function(rawData) {
|
||||
);
|
||||
|
||||
const protocol = defaultServer.protocol || '';
|
||||
|
||||
// Base path is pulled out of the URL, and the trailing slash is removed
|
||||
const basePath = (defaultServer.pathname || '').replace(/\/$/, '');
|
||||
|
||||
const openapiEnv = {
|
||||
_type: 'environment',
|
||||
_id: `env___BASE_ENVIRONMENT_ID___sub`,
|
||||
@@ -75,7 +79,7 @@ module.exports.convert = async function(rawData) {
|
||||
data: {
|
||||
// note: `URL.protocol` returns with trailing `:` (i.e. "https:")
|
||||
scheme: protocol.replace(/:$/, '') || ['http'],
|
||||
base_path: defaultServer.pathname || '',
|
||||
base_path: basePath,
|
||||
host: defaultServer.host || '',
|
||||
...securityVariables,
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user