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

View File

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