diff --git a/contrib/codecs/http/codecs.go b/contrib/codecs/http/codecs.go index 28dec6f7606aa392ea07b163b604b47d625c6703..d7d16b346c7427e8eedaa232e0bf43596f12cec4 100644 --- a/contrib/codecs/http/codecs.go +++ b/contrib/codecs/http/codecs.go @@ -38,6 +38,9 @@ func NewCodec(w http.ResponseWriter, r *http.Request) (jsonrpc.ReaderWriter, err 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)