1
0
Fork 0
mirror of synced 2024-10-03 02:27:06 +13:00

Support variables in URL

This commit is contained in:
Rory Powell 2022-01-05 14:33:14 -05:00
parent 22407446ee
commit 6d5d301adb
2 changed files with 7 additions and 3 deletions

View file

@ -232,8 +232,12 @@
const datasourceUrl = datasource?.config.url
const qs = query?.fields.queryString
breakQs = restUtils.breakQueryString(qs)
if (datasourceUrl && !query.fields.path?.startsWith(datasourceUrl)) {
const path = query.fields.path
if (
datasourceUrl &&
!path?.startsWith("http") &&
!path?.startsWith("{{") // don't substitute the datasource url when query starts with a variable e.g. the upgrade path
) {
query.fields.path = `${datasource.config.url}/${path ? path : ""}`
}
url = buildUrl(query.fields.path, breakQs)

View file

@ -171,7 +171,7 @@ module RestModule {
getUrl(path: string, queryString: string): string {
const main = `${path}?${queryString}`
let complete = main
if (this.config.url && !main.startsWith(this.config.url)) {
if (this.config.url && !main.startsWith("http")) {
complete = !this.config.url ? main : `${this.config.url}/${main}`
}
if (!complete.startsWith("http")) {