fix: client encode

This commit is contained in:
Jon Lundy 2022-04-02 06:50:04 -06:00
parent 76fad092bf
commit 0045113229
No known key found for this signature in database
GPG Key ID: C63E6D61F3035024
2 changed files with 5 additions and 3 deletions

View File

@ -7,6 +7,7 @@ import (
"fmt"
"net/http"
"net/url"
"strconv"
"strings"
"time"
@ -177,7 +178,10 @@ func NewSubscriber(client *Client, topic string, index int, handler msgbus.Handl
u.Scheme = "ws"
}
u.Path += fmt.Sprintf("/%s?index=%d", topic, index)
u.Path += fmt.Sprintf("/%s", topic)
q := u.Query()
q.Set("index", strconv.Itoa(index))
u.RawQuery = q.Encode()
url := u.String()

View File

@ -548,8 +548,6 @@ func (mb *MessageBus) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
log.Debugf("r.URL.Path: %s", r.URL.Path)
topic := strings.Trim(r.URL.Path, "/")
t := mb.NewTopic(topic)