fix: client encode (#27)

Co-authored-by: Jon Lundy <jon@xuu.cc>
Reviewed-on: https://git.mills.io/prologic/msgbus/pulls/27
Co-authored-by: xuu <xuu@noreply@mills.io>
Co-committed-by: xuu <xuu@noreply@mills.io>
このコミットが含まれているのは:
xuu 2022-04-02 13:09:47 +00:00 committed by James Mills
コミット f062b539bc
2個のファイルの変更5行の追加3行の削除

ファイルの表示

@ -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()

ファイルの表示

@ -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)