mirror of
https://github.com/davidallendj/configurator.git
synced 2025-12-20 11:37:00 -07:00
Added util function
This commit is contained in:
parent
926062124a
commit
398031790e
1 changed files with 9 additions and 1 deletions
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue