diff --git a/lib/mandrill/web_hook/event_decorator.rb b/lib/mandrill/web_hook/event_decorator.rb index 3153fd1..54164a7 100644 --- a/lib/mandrill/web_hook/event_decorator.rb +++ b/lib/mandrill/web_hook/event_decorator.rb @@ -84,7 +84,10 @@ def references # Returns the headers Hash. # Applicable events: inbound def headers - msg['headers']||{} + return {} if msg['headers'].nil? || msg['headers'].empty? + return msg['headers'].first if msg['headers'].is_a? Array + + msg['headers'] end # Returns the email (String) of the sender.