mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-03 18:52:15 +08:00
fix 修改mock拦截过滤器的打印
This commit is contained in:
parent
d7ba884ca2
commit
0f7825454c
@ -11,7 +11,7 @@ import (
|
|||||||
func MockBeforeSendFilter1(ctx *rpcChat.SendContext, pb *pbChat.SendMsgReq) (*pbChat.SendMsgResp, bool, error) {
|
func MockBeforeSendFilter1(ctx *rpcChat.SendContext, pb *pbChat.SendMsgReq) (*pbChat.SendMsgResp, bool, error) {
|
||||||
ctxKey := "test_key"
|
ctxKey := "test_key"
|
||||||
v := true
|
v := true
|
||||||
fmt.Printf("MockBeforeSendFilter1:%s set value to ctx,value is :%v\n", ctxKey, v)
|
// fmt.Printf("MockBeforeSendFilter1:%s set value to ctx,value is :%v\n", ctxKey, v)
|
||||||
ctx.WithValue(ctxKey, v)
|
ctx.WithValue(ctxKey, v)
|
||||||
|
|
||||||
return nil, true, nil
|
return nil, true, nil
|
||||||
@ -25,10 +25,10 @@ func MockBeforeSendFilter2(ctx *rpcChat.SendContext, pb *pbChat.SendMsgReq) (*pb
|
|||||||
fmt.Printf("MockBeforeSendFilter2:%s selected from ctx,value is :%v\n", ctxKey, v)
|
fmt.Printf("MockBeforeSendFilter2:%s selected from ctx,value is :%v\n", ctxKey, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("MockBeforeSendHandler trigger,contentType:%d\n", pb.MsgData.GetContentType())
|
// fmt.Printf("MockBeforeSendHandler trigger,contentType:%d\n", pb.MsgData.GetContentType())
|
||||||
if pb.MsgData.ContentType == constant.Text {
|
if pb.MsgData.ContentType == constant.Text {
|
||||||
msg := string(pb.MsgData.Content)
|
msg := string(pb.MsgData.Content)
|
||||||
fmt.Printf("text msg:%s", msg)
|
// fmt.Printf("text msg:%s\n", msg)
|
||||||
if msg == "this is a m..m..mock msg" {
|
if msg == "this is a m..m..mock msg" {
|
||||||
fmt.Println(".==>msg had banned")
|
fmt.Println(".==>msg had banned")
|
||||||
return nil, false, errors.New("BANG! This msg has been banned by MockBeforeSendHandler")
|
return nil, false, errors.New("BANG! This msg has been banned by MockBeforeSendHandler")
|
||||||
|
|||||||
@ -60,6 +60,8 @@ func (c *SendContext) SendMsg(pb *pbChat.SendMsgReq) (*pbChat.SendMsgResp, error
|
|||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fmt.Println("SEND_MSG:before send filters do over")
|
||||||
|
|
||||||
res, err = c.rpc.doSendMsg(c.ctx, pb)
|
res, err = c.rpc.doSendMsg(c.ctx, pb)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, err
|
return res, err
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user