Skip to content

Commit

Permalink
Fix usebruno#2760: Path params trailing slash (usebruno#3065)
Browse files Browse the repository at this point in the history
As reported in usebruno#2670, if a URL has a trailing slash and also contains
path parameters then the original logic had a bug that would drop the
trailing slash.
This implements the fix proposed by @ThenTech.
  • Loading branch information
sam-briggs-depop authored Sep 26, 2024
1 parent 8e22218 commit 2dd5ae4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/bruno-cli/src/runner/interpolate-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ const interpolateVars = (request, envVars = {}, runtimeVariables = {}, processEn
})
.join('');

request.url = url.origin + interpolatedUrlPath + url.search;
const trailingSlash = url.pathname.endsWith('/') ? '/' : '';
request.url = url.origin + interpolatedUrlPath + trailingSlash + url.search;
}

if (request.proxy) {
Expand Down
3 changes: 2 additions & 1 deletion packages/bruno-electron/src/ipc/network/interpolate-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ const interpolateVars = (request, envVariables = {}, runtimeVariables = {}, proc
})
.join('');

request.url = url.origin + urlPathnameInterpolatedWithPathParams + url.search;
const trailingSlash = url.pathname.endsWith('/') ? '/' : '';
request.url = url.origin + urlPathnameInterpolatedWithPathParams + trailingSlash + url.search;
}

if (request.proxy) {
Expand Down

0 comments on commit 2dd5ae4

Please sign in to comment.