diff --git a/swagger.go b/swagger.go index b075403..1698cd1 100644 --- a/swagger.go +++ b/swagger.go @@ -85,7 +85,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 { diff --git a/swagger_test.go b/swagger_test.go index 693326c..694a84b 100644 --- a/swagger_test.go +++ b/swagger_test.go @@ -132,7 +132,7 @@ func TestWithGzipMiddleware(t *testing.T) { w4 := performRequest("GET", "/doc.json", router) assert.Equal(t, 200, w4.Code) - assert.Equal(t, w4.Header()["Content-Type"][0], "application/json") + assert.Equal(t, w4.Header()["Content-Type"][0], "application/json; charset=utf-8") } func performRequest(method, target string, router *gin.Engine) *httptest.ResponseRecorder {