Open edslocombe opened 6 years ago
I have now understood that the above example isn't enough to cause the issue; it's when we have duplicate email headers, which apparently is possible / valid for a number of headers.
An example unit test that'd run (but fail currently) in MandrillMessagesApiTest
:
@Test
public void testParse03_mutlipleValuesForSingleHeader() throws IOException, MandrillApiError {
String testUnparsedMsg =
"Return-Path: <me@googlemail.com>\n" +
"Received: from mail47.google.com\n" +
"Received: by mail47.google.com with SMTP id 123\n" +
"To: " + mailToAddress()+ "\n" +
"Subject: Lutung test subject\n\n" +
"Sup mandrill !";
MandrillMessage parsedMessage = mandrillApi.messages().parse(testUnparsedMsg);
Assume.assumeNotNull(parsedMessage);
Assert.assertEquals("Lutung test subject", parsedMessage.getSubject());
}
I've noticed that when asking Mandrill to parse a raw email the
headers
attribute in the response cannot always be deserialised. Values for a given header can be a string or an array.Headers with multiple values cannot be deserialised into a
MandrillMessage
since header values are only expected to be strings.As an example;
A response from the Mandrill parse request:
The library then throws the following:
I am potentially able to raise a PR that fixes this but will want a release with the fix fairly quickly. Will see how I get on.