From f10bbf405bb93cc3498429561ddd2109ce2ce1f8 Mon Sep 17 00:00:00 2001 From: a <a@tuxpa.in> Date: Mon, 25 Mar 2024 13:13:17 -0500 Subject: [PATCH] a --- contrib/codecs/http/codecs.go | 43 ----------------------------------- 1 file changed, 43 deletions(-) diff --git a/contrib/codecs/http/codecs.go b/contrib/codecs/http/codecs.go index 1f60752..2fc6005 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 -- GitLab