Skip to content

Commit

Permalink
No header set
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jan 15, 2024
1 parent fbba31e commit 1c1ee06
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/mailkick/subscriptions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def unsubscribe

Mailkick::Legacy.opt_out(legacy_options) if Mailkick::Legacy.opt_outs?

if request.post? && request.headers["List-Unsubscribe"] == "One-Click"
if request.post?
render plain: "Unsubscribe successful"
else
redirect_to subscription_path(params[:id])
Expand Down
2 changes: 1 addition & 1 deletion test/controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_unsubscribe_headers
message = UserMailer.with(user: user).welcome.deliver_now
url = message["List-Unsubscribe"].to_s[1..-2]

post url, headers: {"List-Unsubscribe" => "One-Click"}
post url
assert_response :success
assert_includes "Unsubscribe successful", response.body
refute user.subscribed?("sales")
Expand Down

0 comments on commit 1c1ee06

Please sign in to comment.