lib/resend/mailer.rb in resend-0.17.1 vs lib/resend/mailer.rb in resend-0.17.2

- old
+ new

@@ -90,19 +90,25 @@ end params end + # Remove nils from header values + def cleanup_headers(headers) + headers.delete_if { |_k, v| v.nil? } + end + # Gets the values of the headers that are set through the `#mail` method # # @param Mail mail Rails Mail object # @return Hash hash with mail headers values def mail_headers_values(mail) params = {} mail[:headers].unparsed_value.each do |k, v| params[k.to_s] = v end + cleanup_headers(params) params end # Gets the values of the headers that are set through the `#headers` method # @@ -111,11 +117,10 @@ def headers_values(mail) params = {} unignored_headers(mail).each do |h| params[h.name.to_s] = h.unparsed_value end - # remove nil header values - params.delete_if { |_k, v| v.nil? } + cleanup_headers(params) params end # # Add tags fields