-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle tuple based Reply-To headers in Raw content renderer
- Loading branch information
1 parent
bdee330
commit efe6e45
Showing
2 changed files
with
39 additions
and
2 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
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 |
---|---|---|
|
@@ -354,6 +354,34 @@ defmodule Bamboo.SesAdapterTest do | |
|> SesAdapter.deliver(%{}) | ||
end | ||
|
||
test "does not crash with Reply-To tuple and sending raw content" do | ||
expected_request_fn = fn _, _, body, _, _ -> | ||
{:ok, message} = Jason.decode(body) | ||
|
||
%{ | ||
"Content" => %{ | ||
"Raw" => %{ | ||
"Data" => raw_content | ||
} | ||
} | ||
} = message | ||
|
||
email = EmailParser.parse(raw_content) | ||
|
||
assert header_value = EmailParser.header(email, "Reply-To") | ||
assert header_value == "John Schmidt <[email protected]>" | ||
|
||
{:ok, %{status_code: 200, body: body}} | ||
end | ||
|
||
expect(HttpMock, :request, expected_request_fn) | ||
|
||
TestHelpers.new_email() | ||
|> Email.put_header("X-Custom-Header", "header-value") | ||
|> Email.put_header("Reply-To", {"John Schmidt", "[email protected]"}) | ||
|> SesAdapter.deliver(%{}) | ||
end | ||
|
||
test "uses default aws region" do | ||
expected_request_fn = fn _, | ||
"https://email.us-east-1.amazonaws.com/v2/email/outbound-emails", | ||
|