Skip to content

Commit

Permalink
Rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
amishas157 committed Dec 2, 2024
1 parent f5792cd commit f458853
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions utils/apiclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func isRetryableStatusCode(statusCode int) bool {
return statusCode == http.StatusTooManyRequests || statusCode == http.StatusServiceUnavailable
}

func (c *APIClient) GetURL(endpoint string, qstr url.Values) string {
return fmt.Sprintf("%s/%s?%s", c.BaseURL, endpoint, qstr.Encode())
func (c *APIClient) GetURL(endpoint string, queryParams url.Values) string {
return fmt.Sprintf("%s/%s?%s", c.BaseURL, endpoint, queryParams.Encode())
}

func (c *APIClient) CallAPI(reqParams RequestParams) (interface{}, error) {
Expand Down
18 changes: 9 additions & 9 deletions utils/apiclient/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ func TestGetURL(t *testing.T) {
BaseURL: "https://stellar.org",
}

qstr := url.Values{}
qstr.Add("type", "forward")
qstr.Add("federation_type", "bank_account")
qstr.Add("swift", "BOPBPHMM")
qstr.Add("acct", "2382376")
furl := c.GetURL("federation", qstr)
queryParams := url.Values{}
queryParams.Add("type", "forward")
queryParams.Add("federation_type", "bank_account")
queryParams.Add("swift", "BOPBPHMM")
queryParams.Add("acct", "2382376")
furl := c.GetURL("federation", queryParams)
assert.Equal(t, "https://stellar.org/federation?acct=2382376&federation_type=bank_account&swift=BOPBPHMM&type=forward", furl)
}

Expand Down Expand Up @@ -80,13 +80,13 @@ func TestCallAPI(t *testing.T) {
HTTP: hmock,
}

qstr := url.Values{}
qstr.Add("acct", "2382376")
queryParams := url.Values{}
queryParams.Add("acct", "2382376")

reqParams := RequestParams{
RequestType: "GET",
Endpoint: "federation",
QueryParams: qstr,
QueryParams: queryParams,
}

result, err := c.CallAPI(reqParams)
Expand Down

0 comments on commit f458853

Please sign in to comment.