FIX: FIX: Correctly parse Mandrill webhooks (#17116)
Mandrill sends webhook messages as a URL-encoded body, with the mandrill_events property as an encoded JSON array.
This commit is contained in:
parent
1f6e9bd5a9
commit
983a56e3bd
|
@ -49,7 +49,7 @@ class WebhooksController < ActionController::Base
|
|||
end
|
||||
|
||||
def mandrill
|
||||
events = params["mandrill_events"]
|
||||
events = JSON.parse(params["mandrill_events"])
|
||||
events.each do |event|
|
||||
message_id = event.dig("msg", "metadata", "message_id")
|
||||
to_address = event.dig("msg", "email")
|
||||
|
|
|
@ -142,7 +142,7 @@ RSpec.describe WebhooksController do
|
|||
"message_id" => message_id
|
||||
}
|
||||
}
|
||||
}]
|
||||
}].to_json
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
|
|
Loading…
Reference in New Issue