1
0

Remove query escape (endpoint does not apper to support it)

This commit is contained in:
dump_stack() 2023-05-11 19:43:42 +00:00
parent 77be74797b
commit 26c261b6f3
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

@ -6,7 +6,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"net/http" "net/http"
"net/url"
"time" "time"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
@ -111,43 +110,33 @@ func getJson(query string, target interface{}) (err error) {
} }
func GetPackage(name string) (pkg Package, err error) { func GetPackage(name string) (pkg Package, err error) {
query := fmt.Sprintf("%s/package/%s/", apiURL, query := fmt.Sprintf("%s/package/%s/", apiURL, name)
url.QueryEscape(name),
)
err = getJson(query, &pkg) err = getJson(query, &pkg)
return return
} }
func GetBinpackages(name, version string) (binpkgs Binpackages, err error) { func GetBinpackages(name, version string) (binpkgs Binpackages, err error) {
query := fmt.Sprintf("%s/package/%s/%s/binpackages", apiURL, query := fmt.Sprintf("%s/package/%s/%s/binpackages",
url.QueryEscape(name), apiURL, name, version)
url.QueryEscape(version),
)
err = getJson(query, &binpkgs) err = getJson(query, &binpkgs)
return return
} }
func GetBinary(pkg string) (binary Binary, err error) { func GetBinary(pkg string) (binary Binary, err error) {
query := fmt.Sprintf("%s/binary/%s/", apiURL, query := fmt.Sprintf("%s/binary/%s/", apiURL, pkg)
url.QueryEscape(pkg),
)
err = getJson(query, &binary) err = getJson(query, &binary)
return return
} }
func GetBinfiles(binpkg, binversion string) (binfiles Binfiles, err error) { func GetBinfiles(binpkg, binversion string) (binfiles Binfiles, err error) {
query := fmt.Sprintf("%s/binary/%s/%s/binfiles", apiURL, query := fmt.Sprintf("%s/binary/%s/%s/binfiles",
url.QueryEscape(binpkg), apiURL, binpkg, binversion)
url.QueryEscape(binversion),
)
err = getJson(query, &binfiles) err = getJson(query, &binfiles)
return return
} }
func GetInfo(hash string) (info Info, err error) { func GetInfo(hash string) (info Info, err error) {
query := fmt.Sprintf("%s/file/%s/info", apiURL, query := fmt.Sprintf("%s/file/%s/info", apiURL, hash)
url.QueryEscape(hash),
)
err = getJson(query, &info) err = getJson(query, &info)
if err != nil { if err != nil {