SendinBlue "Invalid headers" with non-string custom header
medmunds opened this issue · comments
Using the Sendinblue backend, trying to send a message with an integer or float custom header value has recently started failing:
message = EmailMessage(..., headers={"X-User-Id": 123})
message.send()
That code, which worked on 2022-10-27, now fails with a Sendinblue API error:
anymail.exceptions.AnymailRequestsAPIError: SendinBlue API response 400 (Bad Request):
{
"code": "invalid_parameter",
"message": "Invalid headers"
}
Detected by Anymail weekly integration tests. The 2022-10-27 test run passed, 2022-11-03 test run failed with the error above. This appears to be an unannounced API change, as the only recent entry in Sendinblue's Changelog is about email campaign management.
Workaround: supply a string as the custom header value: headers={"X-User-Id": "123"}
Fix: Anymail should convert basic numeric types to strings (as it does for SendGrid ).
- Anymail 8.6 (and earlier)
- ESP: Sendinblue