msztolcman / sendria

Sendria (formerly MailTrap) is a SMTP server designed to run in your dev/test environment, that is designed to catch any email you or your application is sending, and display it in a web interface instead of sending to real world.
MIT License
149 stars 14 forks source link

Empty list on get emails when inbox is empty #3

Closed KathrynN closed 3 years ago

KathrynN commented 3 years ago

Enhancement request - please provide an empty list when getting all emails from an empty inbox (GET: "/api/messages/")

When the inbox has messages, these are displayed as a list under the key "data", but when the inbox is empty this label is missing. This means that everywhere one calls this, one has to check if the key is present. Personally I think it would be easier from a user's perspective if the list was provided, e.g. 'data':[] so as to not break e.g. streaming from this value.

Thank you!

msztolcman commented 3 years ago

Hi @KathrynN,

In fact, this was an error in Sendria, but it's fixed now. Now all API methods should always return valid structures. Thanks for your report!