diff --git a/contrib/codecs/http/handler.go b/contrib/codecs/http/handler.go index afb0e007b0c19f64338cee28057d6c3418f33ebf..2a7d04271d1c79d2eda41fb457e4e0e9a32088c6 100644 --- a/contrib/codecs/http/handler.go +++ b/contrib/codecs/http/handler.go @@ -8,9 +8,14 @@ import ( "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" + "gfx.cafe/open/jrpc/pkg/jsonrpc" "gfx.cafe/open/jrpc/pkg/server" ) +func JrpcToHttp(h jsonrpc.Handler) http.Handler { + return HttpHandler(server.NewServer(h)) +} + func HttpHandler(s *server.Server) http.Handler { return h2c.NewHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if s == nil {