Update json.go

This commit is contained in:
lihang212010 2020-10-16 14:17:48 +08:00 committed by GitHub
parent d541085b59
commit dccd4e3b72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,6 +52,9 @@ var jsonAsciiContentType = []string{"application/json"}
// Render (JSON) writes data with custom ContentType.
func (r JSON) Render(w http.ResponseWriter) (err error) {
if _, isJson := r.Data.([]byte); isJson {
return
}
if err = WriteJSON(w, r.Data); err != nil {
panic(err)
}