From 64421ca77df0e5f2426fb59a0edc5df83dd5bec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20R=C3=BChl?= Date: Fri, 5 Jan 2024 10:52:30 +0100 Subject: [PATCH 1/2] fix: don't panic when encountering web transports --- httpconnection.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/httpconnection.go b/httpconnection.go index 46f84e6..a770776 100644 --- a/httpconnection.go +++ b/httpconnection.go @@ -3,6 +3,7 @@ package signalr import ( "context" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -127,6 +128,7 @@ func NewHTTPConnection(ctx context.Context, address string, options ...func(*htt switch { case negotiateResponse.hasTransport("WebTransports"): // TODO + return nil, errors.New("support for WebTransports not implemented yet") case httpConn.hasTransport(TransportWebSockets) && negotiateResponse.hasTransport(TransportWebSockets): wsURL := reqURL From b98cd080c9892da3509dacfae590e30753755885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20R=C3=BChl?= Date: Mon, 8 Jan 2024 09:30:56 +0100 Subject: [PATCH 2/2] fix: when server returns unknown negotiation transport return a error --- httpconnection.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/httpconnection.go b/httpconnection.go index a770776..f775fbe 100644 --- a/httpconnection.go +++ b/httpconnection.go @@ -180,6 +180,9 @@ func NewHTTPConnection(ctx context.Context, address string, options ...func(*htt if err != nil { return nil, err } + + default: + return nil, fmt.Errorf("transport not configured or unknown negotiation transports: %v", negotiateResponse.AvailableTransports) } return conn, nil