diff --git a/vendor/github.com/mailhog/MailHog-Server/api/v2.go b/vendor/github.com/mailhog/MailHog-Server/api/v2.go index 4ef0c405..5ddcb721 100644 --- a/vendor/github.com/mailhog/MailHog-Server/api/v2.go +++ b/vendor/github.com/mailhog/MailHog-Server/api/v2.go @@ -4,6 +4,7 @@ import ( "encoding/json" "net/http" "strconv" + "sort" "github.com/gorilla/pat" "github.com/ian-kent/go-log/log" @@ -115,6 +116,11 @@ func (apiv2 *APIv2) messages(w http.ResponseWriter, req *http.Request) { res.Items = []data.Message(*messages) res.Total = apiv2.config.Storage.Count() + log.Println("Attempting sort") + sort.Slice(res.Items, func(i, j int) bool{ + return res.Items[i].Created.After(res.Items[j].Created) + }) + bytes, _ := json.Marshal(res) w.Header().Add("Content-Type", "text/json") w.Write(bytes)