Skip to content

Strip trailing slash from endpoint to prevent malformed URIs#288

Merged
aviadhahami merged 3 commits intomasterfrom
copilot/fix-issue-with-vault-api
Mar 21, 2026
Merged

Strip trailing slash from endpoint to prevent malformed URIs#288
aviadhahami merged 3 commits intomasterfrom
copilot/fix-issue-with-vault-api

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 21, 2026

When endpoint (or VAULT_ADDR) includes a trailing slash (e.g. http://127.0.0.1:8200/), URI construction produces double slashes like http://127.0.0.1:8200//v1/secret/hello.

Fix: Strip trailing slash from client.endpoint at init time, before it's used in URI template on the request path.

client.endpoint = client.endpoint.replace(/\/$/, '');

Tests: Added three tests covering:

  • Endpoint without trailing slash is unchanged
  • Endpoint with trailing slash is trimmed
  • Request URI constructed from trailing-slash endpoint contains no double slashes

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…s in URIs

Co-authored-by: aviadhahami <7353632+aviadhahami@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nodevault/node-vault/sessions/18acbdc1-2e5a-4a10-8209-9c26eefda931
Copilot AI changed the title [WIP] Fix issue with Vault API response handling Strip trailing slash from endpoint URL Mar 21, 2026
Copilot AI requested a review from aviadhahami March 21, 2026 11:22
@aviadhahami aviadhahami marked this pull request as ready for review March 21, 2026 12:01
…ash endpoint

Co-authored-by: aviadhahami <7353632+aviadhahami@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nodevault/node-vault/sessions/909d7cff-651f-47c2-b036-1f413bb6e575
Copilot AI changed the title Strip trailing slash from endpoint URL Strip trailing slash from endpoint to prevent malformed URIs Mar 21, 2026
@aviadhahami aviadhahami merged commit a4f17ba into master Mar 21, 2026
8 checks passed
Copilot stopped work on behalf of aviadhahami due to an error March 21, 2026 12:08
Copilot AI added a commit that referenced this pull request Mar 21, 2026
Strip trailing slash from endpoint to prevent malformed URIs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants