Replace headers in view (#1287)
fixs #1257 Cant add this in the same place as the URL as you end in an infinate loop Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
This commit is contained in:
@@ -1790,6 +1790,17 @@ export default {
|
||||
return (this.response.headers["content-type"] || "").split(";")[0].toLowerCase()
|
||||
},
|
||||
requestCode() {
|
||||
let headers = []
|
||||
if (this.preRequestScript || hasPathParams(this.params)) {
|
||||
let environmentVariables = getEnvironmentVariablesFromScript(this.preRequestScript)
|
||||
environmentVariables = addPathParamsToVariables(this.params, environmentVariables)
|
||||
for (let k of this.headers) {
|
||||
const kParsed = parseTemplateString(k.key, environmentVariables)
|
||||
const valParsed = parseTemplateString(k.value, environmentVariables)
|
||||
headers.push({ key: kParsed, value: valParsed })
|
||||
}
|
||||
}
|
||||
|
||||
return generateCodeWithGenerator(this.requestType, {
|
||||
auth: this.auth,
|
||||
method: this.method,
|
||||
@@ -1799,7 +1810,7 @@ export default {
|
||||
httpUser: this.httpUser,
|
||||
httpPassword: this.httpPassword,
|
||||
bearerToken: this.bearerToken,
|
||||
headers: this.headers,
|
||||
headers: headers,
|
||||
rawInput: this.rawInput,
|
||||
rawParams: this.rawParams,
|
||||
rawRequestBody: this.rawRequestBody,
|
||||
|
||||
Reference in New Issue
Block a user