Merge pull request #220 from wangle201210/v2.0

fix pprof
This commit is contained in:
孟帅
2025-12-09 21:32:38 +08:00
committed by GitHub
2 changed files with 13 additions and 9 deletions

View File

@@ -7,10 +7,11 @@ package consts
import (
"fmt"
"github.com/gogf/gf/v2/errors/gcode"
"hotgo/internal/library/dict"
"hotgo/internal/model"
"net/http"
"github.com/gogf/gf/v2/errors/gcode"
)
func init() {
@@ -20,10 +21,11 @@ func init() {
}
const (
HTTPContentTypeXml = "text/xml"
HTTPContentTypeHtml = "text/html"
HTTPContentTypeStream = "text/event-stream"
HTTPContentTypeJson = "application/json"
HTTPContentTypeXml = "text/xml"
HTTPContentTypeHtml = "text/html"
HTTPContentTypeStream = "text/event-stream"
HTTPContentTypeJson = "application/json"
HTTPContentTypeOctetStream = "application/octet-stream"
)
// HTTPMethodOptions HTTP请求方式选项

View File

@@ -6,15 +6,16 @@
package middleware
import (
"hotgo/internal/consts"
"hotgo/internal/library/response"
"hotgo/utility/charset"
"hotgo/utility/simple"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp"
"github.com/gogf/gf/v2/util/gmeta"
"hotgo/internal/consts"
"hotgo/internal/library/response"
"hotgo/utility/charset"
"hotgo/utility/simple"
)
// ResponseHandler HTTP响应预处理
@@ -45,6 +46,7 @@ func (s *sMiddleware) ResponseHandler(r *ghttp.Request) {
s.responseXml(r)
return
case consts.HTTPContentTypeStream:
case consts.HTTPContentTypeOctetStream:
default:
responseJson(r)
}