ctx.JSON默认开启HTML转义吗?
ljkk opened this issue · comments
ljkk commented
package main
import (
"context"
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/app/server"
"github.com/cloudwego/hertz/pkg/common/utils"
"github.com/cloudwego/hertz/pkg/protocol/consts"
)
func main() {
h := server.Default(server.WithExitWaitTime(0))
h.GET("/ping", func(c context.Context, ctx *app.RequestContext) {
ctx.JSON(consts.StatusOK, utils.H{"message": "<>pong<>"})
})
h.Spin()
}
// curl http://127.0.0.1:8888/ping
,期望返回:{"message":"<>pong<>"}
,实际返回:{"message":"\u003c\u003epong\u003c\u003e"}
github-actions commented
This issue has been marked as invalid question, please give more information by following the issue
template. The issue will be closed in 1 days if no further activity occurs.