diff --git a/contrib/codecs/http/codecs.go b/contrib/codecs/http/codecs.go index 1f607520706848ec72866f95ba7f41e2480e98da..2fc6005a51bf4069bd3847a8955c4d9bebcad1ae 100644 --- a/contrib/codecs/http/codecs.go +++ b/contrib/codecs/http/codecs.go @@ -37,11 +37,6 @@ func NewCodec(w http.ResponseWriter, r *http.Request) (jsonrpc.ReaderWriter, err return NewGetCodec(w, r), nil case http.MethodPost: return NewPostCodec(w, r) - case "JRPC": - if r.Header.Get("Accept") == "text/event-stream" || r.URL.Query().Has("sse") { - return NewSseCodec(w, r) - } - return NewJrpcCodec(w, r) default: http.Error(w, "method not supported", http.StatusMethodNotAllowed) return nil, errors.New("method not allowed") @@ -128,44 +123,6 @@ func NewPostCodec(w http.ResponseWriter, r *http.Request) (*HttpCodec, error) { return c, nil } -func NewJrpcCodec(w http.ResponseWriter, r *http.Request) (*HttpCodec, error) { - c := &HttpCodec{ - r: r, - w: w, - i: jsonrpc.PeerInfo{ - Transport: "http", - RemoteAddr: r.RemoteAddr, - HTTP: r.Clone(r.Context()), - }, - } - c.ctx, c.cn = context.WithCancel(r.Context()) - flusher, ok := w.(http.Flusher) - if ok { - c.f = flusher - } - - data, err := io.ReadAll(r.Body) - if err != nil { - return nil, err - } - - method := strings.TrimPrefix(r.URL.Path, "/") - id := r.Header.Get("Jrpc-Request-Id") - if id == "" { - id = "none" - } - c.msgs = &serverutil.Bundle{ - Messages: []*jsonrpc.Message{{ - ID: jsonrpc.NewId(id), - Method: method, - Params: data, - }}, - Batch: false, - } - - return c, nil -} - // gets the peer info func (c *HttpCodec) PeerInfo() jsonrpc.PeerInfo { return c.i