From 9c85c19254e13dfead8214458ba28878852301fa Mon Sep 17 00:00:00 2001 From: singhwang Date: Thu, 5 Sep 2019 11:48:39 +0800 Subject: [PATCH] Solve the integration swagger into the gin framework, access the Chinese garbled problem in the json returned by swagger/doc.json. --- swagger.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swagger.go b/swagger.go index 445ecbc..5151f6f 100644 --- a/swagger.go +++ b/swagger.go @@ -69,7 +69,7 @@ func CustomWrapHandler(config *Config, h *webdav.Handler) gin.HandlerFunc { } else if strings.HasSuffix(path, ".js") { c.Header("Content-Type", "application/javascript") } else if strings.HasSuffix(path, ".json") { - c.Header("Content-Type", "application/json") + c.Header("Content-Type", "application/json; charset=utf-8") } switch path {