Fix base path in server url for openapi3 import
This commit is contained in:
parent
05607adccb
commit
5380c46725
|
@ -7,7 +7,6 @@
|
|||
Layout,
|
||||
Tabs,
|
||||
Tab,
|
||||
Input,
|
||||
Heading,
|
||||
TextArea,
|
||||
Dropzone,
|
||||
|
@ -98,15 +97,16 @@
|
|||
<Body size="XS"
|
||||
>Import your rest collection using one of the options below</Body
|
||||
>
|
||||
<Tabs selected="Link">
|
||||
<Tab title="Link">
|
||||
<Tabs selected="File">
|
||||
<!-- Commenting until nginx csp issue resolved -->
|
||||
<!-- <Tab title="Link">
|
||||
<Input
|
||||
bind:value={$data.url}
|
||||
on:change={() => (lastTouched = "url")}
|
||||
label="Enter a URL"
|
||||
placeholder="e.g. https://petstore.swagger.io/v2/swagger.json"
|
||||
/>
|
||||
</Tab>
|
||||
</Tab> -->
|
||||
<Tab title="File">
|
||||
<Dropzone
|
||||
gallery={false}
|
||||
|
@ -115,7 +115,14 @@
|
|||
$data.file = e.detail?.[0]
|
||||
lastTouched = "file"
|
||||
}}
|
||||
fileTags={["OpenAPI 2.0", "Swagger 2.0", "cURL", "YAML", "JSON"]}
|
||||
fileTags={[
|
||||
"OpenAPI 3.0",
|
||||
"OpenAPI 2.0",
|
||||
"Swagger 2.0",
|
||||
"cURL",
|
||||
"YAML",
|
||||
"JSON",
|
||||
]}
|
||||
maximum={1}
|
||||
/>
|
||||
</Tab>
|
||||
|
|
|
@ -38,7 +38,11 @@ export abstract class ImportSource {
|
|||
if (typeof url === "string") {
|
||||
path = `${url}/${path}`
|
||||
} else {
|
||||
path = `${url.origin}/${path}`
|
||||
let href = url.href
|
||||
if (href.endsWith("/")) {
|
||||
href = href.slice(0, -1)
|
||||
}
|
||||
path = `${href}/${path}`
|
||||
}
|
||||
}
|
||||
queryString = this.processQuery(queryString)
|
||||
|
|
|
@ -74,7 +74,7 @@ export class Curl extends ImportSource {
|
|||
getQueries = async (datasourceId: string): Promise<Query[]> => {
|
||||
const url = this.getUrl()
|
||||
const name = url.pathname
|
||||
const path = url.pathname
|
||||
const path = url.origin + url.pathname
|
||||
const method = this.curl.method
|
||||
const queryString = url.search
|
||||
const headers = this.curl.headers
|
||||
|
@ -90,7 +90,7 @@ export class Curl extends ImportSource {
|
|||
name,
|
||||
method,
|
||||
path,
|
||||
url,
|
||||
undefined,
|
||||
queryString,
|
||||
headers,
|
||||
[],
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue