Skip to content

fix(config): keep the base url path prefix when building request urls - #116

Merged
AntoniosBarotsis merged 2 commits into
resend:mainfrom
RaphaelFakhri:fix/base-url-path-prefix
Oct 1, 2026
Merged

AntoniosBarotsis merged 2 commits into
resend:mainfrom
RaphaelFakhri:fix/base-url-path-prefix

Conversation

@RaphaelFakhri

@RaphaelFakhri RaphaelFakhri commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Config::build joins the endpoint path onto the base url with Url::join. Every endpoint path starts with /, so join treats it as absolute and discards any path in the base url. A base url such as https://proxy.example.com/resend, set with ConfigBuilder::base_url or RESEND_BASE_URL, sends GET /emails to https://proxy.example.com/emails.

The ConfigBuilder::base_url docs describe pointing the client at a proxy, which commonly lives under a path prefix.

This change appends a trailing slash to the base path when it is missing and joins the endpoint path without its leading slash. A base url without a path builds the same urls as before.

Testing

  • Two unit tests in src/config.rs build request urls for a base url without a path, and for a base url with a path, with and without a trailing slash.
  • With the source change reverted, the prefix test fails. With the change, both pass, with and without the blocking feature.
  • cargo fmt --check and cargo clippy --all-targets report nothing for the changed file.

Summary by cubic

Fixes Config::build so a path prefix in the base url is kept when building request urls. Previously a base url like https://proxy.example.com/resend sent requests to https://proxy.example.com/emails because Url::join treated the endpoint path as absolute and dropped the base path. Now the base path is preserved: trailing slashes are trimmed from it and the endpoint path is joined without its leading slash. Base urls without a path build the same urls as before, and tests cover both cases.

Written for commit 42a4f5d. Summary will update on new commits.

Review in cubic

@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Sep 30, 2026
@AntoniosBarotsis

Copy link
Copy Markdown
Collaborator

Thanks!

@AntoniosBarotsis
AntoniosBarotsis merged commit 2f4fede into resend:main Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants