Proper path parameter replacement
This commit is contained in:
@@ -3,5 +3,5 @@ export default function parseTemplateString(string, variables) {
|
|||||||
return string
|
return string
|
||||||
}
|
}
|
||||||
const searchTerm = /<<([^>]*)>>/g // "<<myVariable>>"
|
const searchTerm = /<<([^>]*)>>/g // "<<myVariable>>"
|
||||||
return string.replace(searchTerm, (match, p1) => variables[p1] || "")
|
return decodeURI(string).replace(searchTerm, (match, p1) => variables[p1] || "")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1590,11 +1590,10 @@ export default {
|
|||||||
set(value) {
|
set(value) {
|
||||||
this.$store.commit("setState", { value, attribute: "uri" })
|
this.$store.commit("setState", { value, attribute: "uri" })
|
||||||
let url = value
|
let url = value
|
||||||
|
|
||||||
if ((this.preRequestScript && this.showPreRequestScript) || hasPathParams(this.params)) {
|
if ((this.preRequestScript && this.showPreRequestScript) || hasPathParams(this.params)) {
|
||||||
let environmentVariables = getEnvironmentVariablesFromScript(this.preRequestScript)
|
let environmentVariables = getEnvironmentVariablesFromScript(this.preRequestScript)
|
||||||
environmentVariables = addPathParamsToVariables(this.params, environmentVariables)
|
environmentVariables = addPathParamsToVariables(this.params, environmentVariables)
|
||||||
url = parseTemplateString(url, environmentVariables)
|
url = parseTemplateString(value, environmentVariables)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
url = new URL(url)
|
url = new URL(url)
|
||||||
@@ -2161,6 +2160,7 @@ export default {
|
|||||||
const body = (this.response.body = payload.data)
|
const body = (this.response.body = payload.data)
|
||||||
const date = new Date().toLocaleDateString()
|
const date = new Date().toLocaleDateString()
|
||||||
const time = new Date().toLocaleTimeString()
|
const time = new Date().toLocaleTimeString()
|
||||||
|
|
||||||
// Addition of an entry to the history component.
|
// Addition of an entry to the history component.
|
||||||
const entry = {
|
const entry = {
|
||||||
label: this.requestName,
|
label: this.requestName,
|
||||||
@@ -2175,6 +2175,13 @@ export default {
|
|||||||
duration,
|
duration,
|
||||||
star: false,
|
star: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((this.preRequestScript && this.showPreRequestScript) || hasPathParams(this.params)) {
|
||||||
|
let environmentVariables = getEnvironmentVariablesFromScript(this.preRequestScript)
|
||||||
|
environmentVariables = addPathParamsToVariables(this.params, environmentVariables)
|
||||||
|
entry.path = parseTemplateString(entry.path, environmentVariables)
|
||||||
|
}
|
||||||
|
|
||||||
this.$refs.historyComponent.addEntry(entry)
|
this.$refs.historyComponent.addEntry(entry)
|
||||||
if (fb.currentUser !== null) {
|
if (fb.currentUser !== null) {
|
||||||
if (fb.currentSettings[2].value) {
|
if (fb.currentSettings[2].value) {
|
||||||
@@ -2200,6 +2207,13 @@ export default {
|
|||||||
usesScripts: Boolean(this.preRequestScript),
|
usesScripts: Boolean(this.preRequestScript),
|
||||||
preRequestScript: this.preRequestScript,
|
preRequestScript: this.preRequestScript,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((this.preRequestScript && this.showPreRequestScript) || hasPathParams(this.params)) {
|
||||||
|
let environmentVariables = getEnvironmentVariablesFromScript(this.preRequestScript)
|
||||||
|
environmentVariables = addPathParamsToVariables(this.params, environmentVariables)
|
||||||
|
entry.path = parseTemplateString(entry.path, environmentVariables)
|
||||||
|
}
|
||||||
|
|
||||||
this.$refs.historyComponent.addEntry(entry)
|
this.$refs.historyComponent.addEntry(entry)
|
||||||
if (fb.currentUser !== null) {
|
if (fb.currentUser !== null) {
|
||||||
if (fb.currentSettings[2].value) {
|
if (fb.currentSettings[2].value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user