Skip to content

Commit 8435fa3

Browse files
committed
refactor(search): use url.Values for query string encoding
Replaces manual query string construction with url.Values to ensure proper encoding of parameters in Search. This improves reliability and readability when building query strings for event retrieval.
1 parent 66e454a commit 8435fa3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

search/search.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"io"
77
"net/http"
8+
"net/url"
89
"strconv"
910
"sync/atomic"
1011

@@ -115,7 +116,11 @@ func (c *Client) GetEvents(ctx context.Context, params string) (*simplejson.Json
115116
func (c *Client) Search(ctx context.Context, j *simplejson.Json, page int) (*Response, error) {
116117
id := j.GetPath("rsid", "id").MustString()
117118

118-
j, err := c.GetEvents(ctx, "rsid="+id+"&page="+strconv.Itoa(page))
119+
qs := url.Values{}
120+
qs.Set("rsid", id)
121+
qs.Set("page", strconv.Itoa(page))
122+
123+
j, err := c.GetEvents(ctx, qs.Encode())
119124

120125
if err != nil {
121126
return nil, err

0 commit comments

Comments
 (0)