From a2bf192d118d6fa367b934add752908524cb6cce Mon Sep 17 00:00:00 2001 From: dydxwill <119354122+dydxwill@users.noreply.github.com> Date: Tue, 20 Aug 2024 13:14:37 -0400 Subject: [PATCH] Support empty params for websocket endpoint (#2111) --- protocol/streaming/ws/websocket_server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/protocol/streaming/ws/websocket_server.go b/protocol/streaming/ws/websocket_server.go index 9df21294e4..0b66804595 100644 --- a/protocol/streaming/ws/websocket_server.go +++ b/protocol/streaming/ws/websocket_server.go @@ -103,6 +103,9 @@ func (ws *WebsocketServer) Handler(w http.ResponseWriter, r *http.Request) { // parseSubaccountIds is a helper function to parse the subaccountIds from the query parameters. func parseSubaccountIds(r *http.Request) ([]*satypes.SubaccountId, error) { subaccountIdsParam := r.URL.Query().Get("subaccountIds") + if subaccountIdsParam == "" { + return []*satypes.SubaccountId{}, nil + } idStrs := strings.Split(subaccountIdsParam, ",") subaccountIds := make([]*satypes.SubaccountId, 0) for _, idStr := range idStrs { @@ -128,6 +131,9 @@ func parseSubaccountIds(r *http.Request) ([]*satypes.SubaccountId, error) { // parseClobPairIds is a helper function to parse the clobPairIds from the query parameters. func parseClobPairIds(r *http.Request) ([]uint32, error) { clobPairIdsParam := r.URL.Query().Get("clobPairIds") + if clobPairIdsParam == "" { + return []uint32{}, nil + } idStrs := strings.Split(clobPairIdsParam, ",") clobPairIds := make([]uint32, 0) for _, idStr := range idStrs {