Skip to content

Commit

Permalink
CLI doesn't interpolate params on the URL usebruno#2587 (usebruno#2588)
Browse files Browse the repository at this point in the history
Co-authored-by: Fabio Grande <fabio.grande@hdhome.it>
  • Loading branch information
2 people authored and jwetzell committed Aug 2, 2024
1 parent e491c3c commit 707836f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/bruno-cli/src/runner/interpolate-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ const interpolateVars = (request, envVars = {}, collectionVariables = {}, proces
request.data = _interpolate(request.data);
}

each(request.params, (param) => {
each(request.pathParams, (param) => {
param.value = _interpolate(param.value);
});

if (request?.params?.length) {
if (request?.pathParams?.length) {
let url = request.url;

if (!url.startsWith('http://') && !url.startsWith('https://')) {
Expand All @@ -107,7 +107,7 @@ const interpolateVars = (request, envVars = {}, collectionVariables = {}, proces
return '/' + path;
} else {
const name = path.slice(1);
const existingPathParam = request.params.find((param) => param.type === 'path' && param.name === name);
const existingPathParam = request.pathParams.find((param) => param.type === 'path' && param.name === name);
return existingPathParam ? '/' + existingPathParam.value : '';
}
})
Expand Down
3 changes: 2 additions & 1 deletion packages/bruno-cli/src/runner/prepare-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const prepareRequest = (request, collectionRoot) => {
let axiosRequest = {
method: request.method,
url: request.url,
headers: headers
headers: headers,
pathParams: request?.params?.filter((param) => param.type === 'path')
};

const collectionAuth = get(collectionRoot, 'request.auth');
Expand Down

0 comments on commit 707836f

Please sign in to comment.