From 2ecc883566332685add06fe55fb39e087b7b8ad7 Mon Sep 17 00:00:00 2001 From: Varun0157 Date: Mon, 10 Jun 2024 12:42:13 +0530 Subject: [PATCH] refactor: reducing repetition in httpRequest's key --- src/replaceVars.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/replaceVars.ts b/src/replaceVars.ts index 3e78449..1accb4a 100644 --- a/src/replaceVars.ts +++ b/src/replaceVars.ts @@ -137,9 +137,10 @@ export function replaceVariablesInRequest(request: RequestSpec, variables: Varia type keyOfHttp = Exclude; const httpPropertiesToReplace: string[] = ["baseUrl", "url", "params", "headers", "body"]; - httpPropertiesToReplace.forEach((key) => { - const replacedData = replaceVariables(request.httpRequest[key as keyOfHttp], variables); - request.httpRequest[key as keyOfHttp] = replacedData.data; + httpPropertiesToReplace.forEach((prop) => { + const httpKey = prop as keyOfHttp; + const replacedData = replaceVariables(request.httpRequest[httpKey], variables); + request.httpRequest[httpKey] = replacedData.data; undefs.push(...replacedData.undefinedVars); });