Fix error code

This commit is contained in:
yzang2019 2024-03-12 15:18:11 +08:00
parent 8c577d5829
commit c27c86e295

View file

@ -18,7 +18,6 @@ package rpc
import ( import (
"context" "context"
"fmt"
"io" "io"
"sync" "sync"
"sync/atomic" "sync/atomic"
@ -162,7 +161,7 @@ func (s *Server) serveSingleRequest(ctx context.Context, codec ServerCodec) {
for _, req := range reqs { for _, req := range reqs {
method := req.Method method := req.Method
if _, found := s.denyList[method]; found { if _, found := s.denyList[method]; found {
resp := errorMessage(&methodNotFoundError{fmt.Sprintf("method %s is in deny list", method)}) resp := errorMessage(&methodNotFoundError{method: method})
codec.writeJSON(ctx, resp, true) codec.writeJSON(ctx, resp, true)
return return
} }