Closed ljkk closed 1 month ago
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"}
curl http://127.0.0.1:8888/ping
{"message":"<>pong<>"}
{"message":"\u003c\u003epong\u003c\u003e"}
https://www.cloudwego.io/docs/hertz/tutorials/basic-feature/render/#purejson
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.
issue
//
curl http://127.0.0.1:8888/ping
,期望返回:{"message":"<>pong<>"}
,实际返回:{"message":"\u003c\u003epong\u003c\u003e"}