接口是正常的返回data数据,然后调用流程如下:
respose := gin.H{"errNo": 0, "errStr": "success", "data": data}
body, err := jsoniter.Marshal(respose)
if err != nil {
ctx.String(200, `{"errNo":0,"errStr":"success","data":{}}`)
}
ctx.String(200, exbytes.ToString(body))
报错如下:
err[write tcp 192.168.130.43:8913->192.168.130.26:35126: i/o timeout] stack[goroutine 13045825 [running]:
runtime/debug.Stack(0xc00038d800, 0xf13400, 0xc00021c140)
/home/homework/goroot/go1.13.5/src/runtime/debug/stack.go:24 +0x9d
mainstation/web/middleware.Recovery.func1.1(0xc0000f2e70)
/home/homework/localBuildPath/go/kid/mainstation/8f841112f7cbe4891e0d9f21d572dbc1/src/mainstation/web/middleware/recovery.go:20 +0xa6
panic(0xf134e0, 0xc0000dc000)
/home/homework/goroot/go1.13.5/src/runtime/panic.go:679 +0x1b2
github.com/gin-gonic/gin.(*Context).Render(0xc0000f2e70, 0xc8, 0x11d0560, 0xc000544210)
/home/homework/go/pkg/mod/github.com/gin-gonic/gin@v1.4.0/context.go:769 +0x16c
github.com/gin-gonic/gin.(*Context).String(...)