fixed HTTP status codes write error

This commit is contained in:
orgin
2022-05-12 09:45:22 +08:00
parent 13642d7402
commit ee54862be2

View File

@@ -175,10 +175,12 @@ func (slf *HttpSession) Write(msg []byte) {
func (slf *HttpSession) WriteJsonDone(statusCode int,msgJson interface{}) error { func (slf *HttpSession) WriteJsonDone(statusCode int,msgJson interface{}) error {
msg, err := json.Marshal(msgJson) msg, err := json.Marshal(msgJson)
if err == nil { if err != nil {
slf.Write(msg) return err
} }
slf.statusCode = statusCode
slf.Write(msg)
slf.Done() slf.Done()
return err return err
} }