ruffrey/mailsac

Content type is not consistently provided by all endpoints

jrosiek opened this issue · 3 comments

Example:
GET /api/addresses/:email/messages returns content type application/json as expected
whereas:
GET /api/headers/:email/:messageId does not provide any content-type header. I would expect application/json here.

I did not test all endpoints, so the problem may manifest on remaining as well....

The issue is more interesting than I thought. On some endpoints the server does not send 'Content-Type' header at all - even if I explicitly request specific media type with "Accept" header. This is very painful if you for example use some Java frameworks for parsing. They usually depend on Content-Type to properly handle parsing from Json to objects. If the content type is not provided they will assume "application/octet-stream" and won't find suitable parser. There is some serious customization needed in the framework to mitigate this issue.

That is interesting. Looking into it now.

The issue should be fixed now. A few other routes listed below were also missing headers. Please confirm things are fixed and reopen this issue if not.

/api/dirty/:inbox/:messageId
/api/raw/:inbox/:messageId
/api/headers/:inbox/:messageId
/api/text/:inbox/:messageId
/api/body/:inbox/:messageId