diff --git a/api/client.go b/api/client.go index 281f987..c9e0622 100644 --- a/api/client.go +++ b/api/client.go @@ -2,6 +2,8 @@ package api import ( "fmt" + "net/url" + "strconv" "go.sia.tech/core/consensus" "go.sia.tech/core/types" @@ -267,6 +269,11 @@ func (c *Client) Search(id types.Hash256) (resp explorer.SearchType, err error) // HostsList searches the hosts by the given criteria. func (c *Client) HostsList(params explorer.HostQuery, sortBy explorer.HostSortColumn, dir explorer.HostSortDir, offset, limit uint64) (resp []explorer.Host, err error) { - err = c.c.POST(fmt.Sprintf("/hosts?sort=%s&dir=%s&offset=%d&limit=%d", sortBy, dir, offset, limit), params, &resp) + v := url.Values{} + v.Add("sort", string(sortBy)) + v.Add("dir", string(dir)) + v.Add("offset", strconv.FormatUint(offset, 10)) + v.Add("limit", strconv.FormatUint(limit, 10)) + err = c.c.POST("/hosts?"+v.Encode(), params, &resp) return }