Do not serialize message arguments when they are empty

This commit is contained in:
wpetit 2018-09-18 18:02:19 +02:00
parent 67dd1d6bfb
commit 85050e6154
1 changed files with 7 additions and 1 deletions

View File

@ -72,7 +72,13 @@ func Encode(msg *Message) (string, error) {
return "", err
}
return result + "[" + string(jsonMethod) + "," + msg.Args + "]", nil
encoded := result + "[" + string(jsonMethod)
if msg.Args != "" {
encoded += "," + msg.Args
}
encoded += "]"
return encoded, nil
}
func MustEncode(msg *Message) string {