Repository navigation
fix(emails): send attachment content type as content_type - #118
Merged
AntoniosBarotsis merged 2 commits intoOct 13, 2026
Merged
Conversation
commit 548f4de Author: Antonios Barotsis <a.barotsis@student.tudelft.nl> Date: Tue Oct 13 20:53:46 2026 +0200 Fix lints
Collaborator
|
LGTM, thanks for the heads up and apologies for the delay, I've been busy the last few days. I'll talk to the team and make sure this is how it should function before releasing but that shouldn't take long (probably expect a release tomorrow at the latest). |
AntoniosBarotsis
added a commit
that referenced
this pull request
Oct 16, 2026
commit 122fac8 Author: Raphael Fakhri <153192858+RaphaelFakhri@users.noreply.github.com> Date: Tue Oct 13 21:57:44 2026 +0300 fix(emails): send attachment content type as content_type (#118) * fix(emails): send attachment content type as content_type * Squashed commit of the following: commit 548f4de Author: Antonios Barotsis <a.barotsis@student.tudelft.nl> Date: Tue Oct 13 20:53:46 2026 +0200 Fix lints --------- Co-authored-by: Antonios Barotsis <a.barotsis@student.tudelft.nl> commit 548f4de Author: Antonios Barotsis <a.barotsis@student.tudelft.nl> Date: Tue Oct 13 20:53:46 2026 +0200 Fix lints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CreateAttachmentrenames itscontent_typefield tocontentTypewhen it serializes. The send email endpoint reads the attachment content type fromcontent_type, as the API reference and the other SDKs do, so a content type set withwith_content_typenever reaches the API and the API derives the type from the filename instead.For example, an attachment built with
.with_filename("invoice").with_content_type("application/pdf")currently serializes as{"path":"...","filename":"invoice","contentType":"application/pdf"}.The Node SDK fixed the same casing in resend/resend-node#391. This change drops the rename so the field serializes as
content_type.Changes
src/emails.rs: removerename = "contentType"fromCreateAttachment::content_type, and add a unit test that checks the serialized key.CHANGELOG.md: add anUnreleasedentry underFixed.Testing
cargo test --lib attachment_content_typefails without the fix (content_typeis missing from the JSON) and passes with it, with and without--features blocking.cargo fmt --checkandcargo clippy --all-targets(with and without--features blocking) report nothing.Summary by cubic
Fixes attachment content type serialization so
with_content_typevalues reach the API instead of being ignored.CreateAttachmentpreviously renamed the field tocontentTypeduring serialization, but the send email endpoint expectscontent_type. The API was deriving the type from the filename instead. This change strips the rename, adds a unit test verifying the serialized key, and updates test assertions to satisfy clippy.Written for commit 601580e. Summary will update on new commits.