-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Properly handle null header values (#91)
- Loading branch information
Showing
4 changed files
with
19 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
resend (0.16.0) | ||
resend (0.17.1) | ||
httparty (>= 0.21.0) | ||
|
||
GEM | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Resend | ||
VERSION = "0.17.0" | ||
VERSION = "0.17.1" | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,14 @@ def with_overwritten_headers(to, subject) | |
end | ||
end | ||
|
||
def with_nil_header_values(to, subject) | ||
headers["X-Entity-Ref-ID"] = nil | ||
mail(to: to, subject: subject) do |format| | ||
format.text { render plain: "txt" } | ||
format.html { render html: "<p>html</p>".html_safe } | ||
end | ||
end | ||
|
||
def with_attachment(to, subject) | ||
attachments['invoice.pdf'] = { | ||
:content => File.read('resources/invoice.pdf'), | ||
|
@@ -135,7 +143,7 @@ class TestMailerWithDisplayName < TestMailer | |
expect(body[:headers]["X-Entity-Ref-ID"]).to eql("123") | ||
end | ||
|
||
it "#mail properly overwrites #headers" do | ||
it "#build_resend_params properly overwrites #headers" do | ||
message = TestMailer.with_overwritten_headers("[email protected]", "Test!") | ||
body = @mailer.build_resend_params(message) | ||
expect(body[:from]).to eql("[email protected]") | ||
|
@@ -145,4 +153,10 @@ class TestMailerWithDisplayName < TestMailer | |
expect(body[:text]).to eql("txt") | ||
expect(body[:headers]["X-Entity-Ref-ID"]).to eql("overwritten") | ||
end | ||
|
||
it "#build_resend_params handles nil values" do | ||
message = TestMailer.with_nil_header_values("[email protected]", "Test!") | ||
body = @mailer.build_resend_params(message) | ||
expect(body[:headers]).to be nil | ||
end | ||
end |