From 84c2db7bfa9268200dc3a249b66403c798c3834a Mon Sep 17 00:00:00 2001 From: Zhivko Draganov Date: Tue, 19 Jan 2016 10:35:58 +0200 Subject: [PATCH] Temporary fix for empty headers array submitted --- lib/mandrill/web_hook/event_decorator.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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.