sendgrid / sendgrid-python

The Official Twilio SendGrid Python API Library
https://sendgrid.com
MIT License
1.53k stars 712 forks source link

fix: Mail.add_header doesn't accept a dict #1054

Closed hassaku63 closed 1 year ago

hassaku63 commented 2 years ago

Fixes #997

Headers are correctly added even if the argument of add_header is of type dict.

The current spec seems to intend that only the first key/value is added when a dict type argument is given. I couldn't figure out why this implementation. I think the spec should apply to all keys/values that a dict argument has. The current spec is non-intuitive and confusing to users.

However, changes for supports to multiple key/value pairs could result in "breaking change", so the policy in this pull request was to keep changes to a minimum.

Checklist

If you have questions, please file a support ticket, or create a GitHub Issue in this repository.