feat: support for gzip middleware (#53)
This commit is contained in:
+11
@@ -4,6 +4,7 @@ import (
|
||||
"html/template"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/net/webdav"
|
||||
|
||||
@@ -61,6 +62,16 @@ func CustomWrapHandler(config *Config, h *webdav.Handler) gin.HandlerFunc {
|
||||
prefix := matches[1]
|
||||
h.Prefix = prefix
|
||||
|
||||
if strings.HasSuffix(path, ".html") {
|
||||
c.Header("Content-Type", "text/html; charset=utf-8")
|
||||
} else if strings.HasSuffix(path, ".css") {
|
||||
c.Header("Content-Type", "text/css; charset=utf-8")
|
||||
} else if strings.HasSuffix(path, ".js") {
|
||||
c.Header("Content-Type", "application/javascript")
|
||||
} else if strings.HasSuffix(path, ".json") {
|
||||
c.Header("Content-Type", "application/json")
|
||||
}
|
||||
|
||||
switch path {
|
||||
case "index.html":
|
||||
index.Execute(c.Writer, &swaggerUIBundle{
|
||||
|
||||
Reference in New Issue
Block a user