ruffrey / mailsac

A disposable SMTP test server and email web client frontend, build on Node.js, Mongo and Redis
https://mailsac.com
MIT License
269 stars 90 forks source link

Content type is not consistently provided by all endpoints #36

Closed jrosiek closed 7 years ago

jrosiek commented 7 years ago

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....

jrosiek commented 7 years ago

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.

ruffrey commented 7 years ago

That is interesting. Looking into it now.

ruffrey commented 7 years ago

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