Skip to content

Commit 1239baf

Browse files
committed
chore: added graceful check while accessing path params
1 parent b2038c7 commit 1239baf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/bruno-cli/src/runner/interpolate-vars.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const interpolateVars = (request, envVars = {}, collectionVariables = {}, proces
8282
request.data = _interpolate(request.data);
8383
}
8484

85-
each(request.pathParams, (param) => {
85+
each(request?.pathParams, (param) => {
8686
param.value = _interpolate(param.value);
8787
});
8888

@@ -107,7 +107,7 @@ const interpolateVars = (request, envVars = {}, collectionVariables = {}, proces
107107
return '/' + path;
108108
} else {
109109
const name = path.slice(1);
110-
const existingPathParam = request.pathParams.find((param) => param.type === 'path' && param.name === name);
110+
const existingPathParam = request?.pathParams?.find((param) => param.type === 'path' && param.name === name);
111111
return existingPathParam ? '/' + existingPathParam.value : '';
112112
}
113113
})

0 commit comments

Comments
 (0)