Added util function

This commit is contained in:
David Allen 2024-06-26 10:15:31 -06:00
parent 926062124a
commit 398031790e
No known key found for this signature in database
GPG key ID: 717C593FF60A2ACC

View file

@ -26,7 +26,7 @@ func MakeRequest(url string, httpMethod string, body []byte, headers map[string]
if err != nil { if err != nil {
return nil, nil, fmt.Errorf("could not create new HTTP request: %v", err) return nil, nil, fmt.Errorf("could not create new HTTP request: %v", err)
} }
req.Header.Add("User-Agent", "magellan") req.Header.Add("User-Agent", "configurator")
for k, v := range headers { for k, v := range headers {
req.Header.Add(k, v) req.Header.Add(k, v)
} }
@ -41,3 +41,11 @@ func MakeRequest(url string, httpMethod string, body []byte, headers map[string]
} }
return res, b, err return res, b, err
} }
func ConvertMapOutput(m map[string][]byte) map[string]string {
n := make(map[string]string, len(m))
for k, v := range m {
n[k] = string(v)
}
return n
}