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()
|
return (this.response.headers["content-type"] || "").split(";")[0].toLowerCase()
|
||||||
},
|
},
|
||||||
requestCode() {
|
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, {
|
return generateCodeWithGenerator(this.requestType, {
|
||||||
auth: this.auth,
|
auth: this.auth,
|
||||||
method: this.method,
|
method: this.method,
|
||||||
@@ -1799,7 +1810,7 @@ export default {
|
|||||||
httpUser: this.httpUser,
|
httpUser: this.httpUser,
|
||||||
httpPassword: this.httpPassword,
|
httpPassword: this.httpPassword,
|
||||||
bearerToken: this.bearerToken,
|
bearerToken: this.bearerToken,
|
||||||
headers: this.headers,
|
headers: headers,
|
||||||
rawInput: this.rawInput,
|
rawInput: this.rawInput,
|
||||||
rawParams: this.rawParams,
|
rawParams: this.rawParams,
|
||||||
rawRequestBody: this.rawRequestBody,
|
rawRequestBody: this.rawRequestBody,
|
||||||
|
|||||||
Reference in New Issue
Block a user