MCPcopy Create free account
hub / github.com/LockGit/gochat / ResponseWithCode

Function ResponseWithCode

tools/response.go:35–49  ·  view source on GitHub ↗
(c *gin.Context, msgCode int, msg interface{}, data interface{})

Source from the content-addressed store, hash-verified

33}
34
35func ResponseWithCode(c *gin.Context, msgCode int, msg interface{}, data interface{}) {
36 if msg == nil {
37 if val, ok := MsgCodeMap[msgCode]; ok {
38 msg = val
39 } else {
40 msg = MsgCodeMap[-1]
41 }
42 }
43
44 c.AbortWithStatusJSON(http.StatusOK, gin.H{
45 "code": msgCode,
46 "message": msg,
47 "data": data,
48 })
49}

Callers 3

CheckSessionIdFunction · 0.92
SuccessWithMsgFunction · 0.85
FailWithMsgFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected