From c810675d3a9707776a77cb740c13c7deeb8d5a00 Mon Sep 17 00:00:00 2001 From: 07Pedro <149793367+07Pedro@users.noreply.github.com> Date: Wed, 31 Jan 2024 15:19:24 +0100 Subject: [PATCH] Update v1.go Use the right Media Type for JSON: "application/json" instead of "text/json" #165 --- vendor/github.com/mailhog/MailHog-Server/api/v1.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vendor/github.com/mailhog/MailHog-Server/api/v1.go b/vendor/github.com/mailhog/MailHog-Server/api/v1.go index 9bebf4ad..ea8a3fe0 100644 --- a/vendor/github.com/mailhog/MailHog-Server/api/v1.go +++ b/vendor/github.com/mailhog/MailHog-Server/api/v1.go @@ -129,12 +129,12 @@ func (apiv1 *APIv1) messages(w http.ResponseWriter, req *http.Request) { case *storage.MongoDB: messages, _ := apiv1.config.Storage.(*storage.MongoDB).List(0, 1000) bytes, _ := json.Marshal(messages) - w.Header().Add("Content-Type", "text/json") + w.Header().Add("Content-Type", "application/json") w.Write(bytes) case *storage.InMemory: messages, _ := apiv1.config.Storage.(*storage.InMemory).List(0, 1000) bytes, _ := json.Marshal(messages) - w.Header().Add("Content-Type", "text/json") + w.Header().Add("Content-Type", "application/json") w.Write(bytes) default: w.WriteHeader(500) @@ -161,7 +161,7 @@ func (apiv1 *APIv1) message(w http.ResponseWriter, req *http.Request) { return } - w.Header().Set("Content-Type", "text/json") + w.Header().Set("Content-Type", "application/json") w.Write(bytes) } @@ -241,7 +241,7 @@ func (apiv1 *APIv1) delete_all(w http.ResponseWriter, req *http.Request) { apiv1.defaultOptions(w, req) - w.Header().Add("Content-Type", "text/json") + w.Header().Add("Content-Type", "application/json") err := apiv1.config.Storage.DeleteAll() if err != nil { @@ -259,7 +259,7 @@ func (apiv1 *APIv1) release_one(w http.ResponseWriter, req *http.Request) { apiv1.defaultOptions(w, req) - w.Header().Add("Content-Type", "text/json") + w.Header().Add("Content-Type", "application/json") msg, _ := apiv1.config.Storage.Load(id) decoder := json.NewDecoder(req.Body) @@ -348,7 +348,7 @@ func (apiv1 *APIv1) delete_one(w http.ResponseWriter, req *http.Request) { apiv1.defaultOptions(w, req) - w.Header().Add("Content-Type", "text/json") + w.Header().Add("Content-Type", "application/json") err := apiv1.config.Storage.DeleteOne(id) if err != nil { log.Println(err)