refactor: move json related header vars to internal (#1840)

* refactor: move json related header vars to internal

* refactor: use header.ContentType
This commit is contained in:
Kevin Wan
2022-04-28 15:12:04 +08:00
committed by GitHub
parent cef83efd4e
commit 3bbc90ec24
14 changed files with 58 additions and 42 deletions

View File

@@ -6,6 +6,7 @@ import (
"sync"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest/internal/header"
)
var (
@@ -67,7 +68,7 @@ func WriteJson(w http.ResponseWriter, code int, v interface{}) {
return
}
w.Header().Set(ContentType, ApplicationJson)
w.Header().Set(ContentType, header.JsonContentType)
w.WriteHeader(code)
if n, err := w.Write(bs); err != nil {