Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting the the host endpoint #99

Merged
merged 2 commits into from
Jul 2, 2023

Conversation

nicholas-l
Copy link
Contributor

This allows easier testing for consumers of this library. The endpoint
can be set to be a local server to verify the email is sent correctly.

This allows easier testing for consumers of this library. The endpoint
can be set to be a local server to verify the email is sent correctly.
src/client.rs Outdated
@@ -19,6 +19,7 @@ static API_URL: &str = "https://api.sendgrid.com/api/mail.send.json?";
#[derive(Clone, Debug)]
pub struct SGClient {
api_key: String,
host: Option<String>,
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe we can just have this be a String and set it to the API_URL value in new? IMO we should always have a host.

The set_host function can just mutate the value.

Copy link
Contributor Author

@nicholas-l nicholas-l Jul 2, 2023

Choose a reason for hiding this comment

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

Great point, will make that change. Would it be better for backwards compatibility to create a new constructor such as new_with_host so that existing calls to new continue to work? Actually, set_host can covert this.

@gsquire gsquire merged commit 612f798 into gsquire:master Jul 2, 2023
1 check passed
@gsquire
Copy link
Owner

gsquire commented Jul 2, 2023

LGTM, thanks!

@gsquire
Copy link
Owner

gsquire commented Jul 2, 2023

This will be published in version 0.19.1 shortly.

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.

None yet

2 participants