зеркало из https://github.com/mozilla/mig.git
Add a little more resiliency for differently formed URLs
This commit is contained in:
Родитель
bf615806b0
Коммит
bb6cf19a19
|
@ -16,6 +16,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -312,10 +313,14 @@ func GetAuthToken() (string, error) {
|
||||||
// load them into a searchable map, keyed to asset hostname
|
// load them into a searchable map, keyed to asset hostname
|
||||||
// the ServiceAPI object must already be loaded with a Bearer token
|
// the ServiceAPI object must already be loaded with a Bearer token
|
||||||
func GetAssets(m map[string]ServiceApiAsset) error {
|
func GetAssets(m map[string]ServiceApiAsset) error {
|
||||||
|
|
||||||
// get json array of assets from serviceapi
|
// get json array of assets from serviceapi
|
||||||
requestURL := conf.ServiceApi.URL + "api/v1/assets/"
|
requestURL, err := url.Parse(conf.ServiceApi.URL)
|
||||||
req, err := http.NewRequest(http.MethodGet, requestURL, nil)
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
requestURL.Path = "api/v1/assets/"
|
||||||
|
req, err := http.NewRequest(http.MethodGet, requestURL.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче