This commit is contained in:
houseme
2022-03-09 18:30:32 +08:00
parent 920dbbef5e
commit 5537930210

View File

@ -7,6 +7,8 @@
package ghttp
import (
"fmt"
"github.com/gogf/gf/v2/text/gstr"
)
@ -45,7 +47,7 @@ func (s *Server) swaggerUI(r *Request) {
if r.StaticFile != nil && r.StaticFile.File != nil && r.StaticFile.IsDir {
content := gstr.ReplaceByMap(swaggerUITemplate, map[string]string{
swaggerUIDocURLPlaceHolder: s.config.OpenApiPath,
swaggerUIDocNamePlaceHolder: gstr.TrimRight(r.GetUrl(), "/") + "/" + swaggerUIDocName,
swaggerUIDocNamePlaceHolder: gstr.TrimRight(fmt.Sprintf(`//%s%s`, r.Host, r.URL.String()), "/") + "/" + swaggerUIDocName,
})
r.Response.Write(content)
r.ExitAll()