Skip to content

Enforce Trailing Slash On Go RPC URLs#17

Merged
THEjacob1000 merged 1 commit intomasterfrom
feature/enforce-trailing-slash
Mar 5, 2026
Merged

Enforce Trailing Slash On Go RPC URLs#17
THEjacob1000 merged 1 commit intomasterfrom
feature/enforce-trailing-slash

Conversation

@THEjacob1000
Copy link
Copy Markdown
Contributor

Internal change only

This pull request improves the handling of base URLs in the lokerpc client by ensuring they are consistently normalized. It introduces a utility function to standardize base URLs and adds comprehensive tests to verify this behavior.

Submitter Checklist

Check only those that apply to this change.

  • Self-reviewed code, removed extraneous comments, debug logging, checked code style
  • No change to users after merge (off-by-default configuration, feature flag, alt URL, etc.) and can be disabled if issues arise (if this is not the case we may need stakeholder signoff)
  • Changes are documented (README, wiki, etc)
  • Automated tests added or existing tests cover the new functionality or changes
  • Manually tested changes
  • Metrics added to track the usage/performance
  • I am confident I can revert this change
  • Database migrations are reversible without data loss (if applicable)
  • Performance impact is acceptable (if applicable)
  • Any new dependencies are justified or have been approved (if applicable)
  • This is NOT a high risk change (if it is, please follow the high-risk change process)

Testing Evidence

What evidence supports that you have tested this change?

  • Test cases cover the new functionality or changes
  • Screenshots or logs of the changes (if applicable)
  • Performance benchmarks (if applicable)
  • Storybook cases (if applicable)

Reviewer Checklist

Note: if this PR affects authentication or payments please seek a secondary tester.

  • I am ok with code style and functionality
  • I have personally tested the feature
  • My review was not rushed due to time constraints

@THEjacob1000 THEjacob1000 self-assigned this Mar 5, 2026
Comment on lines +54 to +56
func normalizeBaseURL(baseURL string) string {
return strings.TrimRight(baseURL, "/") + "/"
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mimicked functionality from @loke/http-rpc-client: https://github.com/LOKE/loke-http-rpc-client/blob/master/src/client.ts#L17-L19

@THEjacob1000 THEjacob1000 requested a review from smithamax March 5, 2026 22:06
Comment on lines +26 to +30
{
name: "collapses multiple trailing slashes",
baseURL: "http://example.com/rpc/service///",
expected: "http://example.com/rpc/service/",
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that it really matters, but it probably shouldn't strip multiple /

@THEjacob1000 THEjacob1000 merged commit 1c93864 into master Mar 5, 2026
1 check passed
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