lib/sendgrid_actionmailer.rb in sendgrid-actionmailer-2.2.0 vs lib/sendgrid_actionmailer.rb in sendgrid-actionmailer-2.2.1
- old
+ new
@@ -134,10 +134,10 @@
end
end
end
def json_parse(text, symbolize=true)
- JSON.parse(text.gsub(/:*\"*([\%a-zA-Z0-9_-]*)\"*(( *)=>\ *)/) { "\"#{$1}\":" }, symbolize_names: symbolize)
+ JSON.parse(text.empty? ? '{}' : text.gsub(/:*\"*([\%a-zA-Z0-9_-]*)\"*(( *)=>\ *)/) { "\"#{$1}\":" }, symbolize_names: symbolize)
end
def add_send_options(sendgrid_mail, mail)
if mail['template_id']
sendgrid_mail.template_id = mail['template_id'].to_s