Skip to content

Commit

Permalink
fix: bad url encoding (#1645)
Browse files Browse the repository at this point in the history
  • Loading branch information
gotbadger committed Jun 27, 2024
1 parent 1481ae0 commit d8df782
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions api/version.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package api

import "net/url"
import (
"fmt"
"net/url"
)

func (api *API) Version(languages []string) ([]byte, error) {
endpoint := Endpoints.Version
languageQuery := url.Values{}
queryString := "/?"
for _, lang := range languages {
languageQuery.Add("_json[]", lang)
queryString += fmt.Sprintf("_json[]=%s&", url.QueryEscape(lang))
}
response, err := api.makeRequest(endpoint.Route+languageQuery.Encode(), endpoint.HttpMethod, nil)
response, err := api.makeRequest(endpoint.Route+queryString, endpoint.HttpMethod, nil)

return response, err
}

0 comments on commit d8df782

Please sign in to comment.